Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow Cython compilation to open a web browser containing the annotated HTML file #38946

Open
wants to merge 10 commits into
base: develop
Choose a base branch
from

Conversation

user202729
Copy link
Contributor

@user202729 user202729 commented Nov 9, 2024

As in the title.

I think this is a rather common use case, to investigate whether the code does get the desired speedup.

Remark: there's sage.misc.viewer.browser() which could be used instead, but then a lot of existing code in SageMath uses webbrowser.open() anyway?

📝 Checklist

  • The title is concise and informative.
  • The description explains in detail what this PR is about.
  • I have linked a relevant issue or discussion. (not aware of one)
  • I have created tests covering the changes.
  • I have updated the documentation and checked the documentation preview.

Dependencies

Depends on #38945 .

Copy link

github-actions bot commented Nov 9, 2024

Documentation preview for this PR (built with commit 99bce53; changes) is ready! 🎉
This preview will update shortly after each push to this PR.

@user202729 user202729 changed the title Allow passing view_annotate=True to Cython compilation Allow Cython compilation to open a web browser containing the annotated HTML file Nov 9, 2024
@kwankyu
Copy link
Collaborator

kwankyu commented Nov 10, 2024

This looks nice.

It would be nicer if the new argument view_annotate is accepted to the cell magic %%cython. For example,

%%cython view_annotate=True
def f(int n):
...

or

%%cython --view_annotate
def f(int n):
...

The cell magic is defined in https://github.com/sagemath/sage/blob/develop/src/sage/repl/ipython_extension.py. Find the line

def cython(self, line, cell):

line seems to accept the part after "%%cython". So we may use it to provide arguments to the cython function. What do you think?

@user202729
Copy link
Contributor Author

Already did that in #38945 . (though whichever being merged first need to be modified to incorporate the other…)

@kwankyu
Copy link
Collaborator

kwankyu commented Nov 10, 2024

You may set #38945 as a dependency and merge it here.

@kwankyu
Copy link
Collaborator

kwankyu commented Nov 10, 2024

and instead of

- ``line`` -- parsed as keyword arguments. See :func:`~sage.misc.cython.cython` for details.

you may at least list the possible arguments for users' convenience, leaving details to sage.misc.cython.cython .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants