Allow Cython compilation to open a web browser containing the annotated HTML file#38946
Allow Cython compilation to open a web browser containing the annotated HTML file#38946vbraun merged 12 commits intosagemath:developfrom
Conversation
|
Documentation preview for this PR (built with commit 6116696; changes) is ready! 🎉 |
|
This looks nice. It would be nicer if the new argument or The cell magic is defined in https://github.com/sagemath/sage/blob/develop/src/sage/repl/ipython_extension.py. Find the line
|
|
Already did that in #38945 . (though whichever being merged first need to be modified to incorporate the other…) |
|
You may set #38945 as a dependency and merge it here. |
|
and instead of you may at least list the possible arguments for users' convenience, leaving details to |
b8d3e69 to
99bce53
Compare
|
I learnt it's possible to view the result in the Sage notebook (if Jupyter-based notebook GUI is used) from looking at cython-provided magic, so I implement that here. |
269c4d8 to
0447579
Compare
0447579 to
0fc93c2
Compare
|
@kwankyu Can you review the PR? Thanks. |
|
Conflicts? |
|
Huh, that only come from the new commits for 10.6.beta2 today. This one is pretty harmless. |
Yes. That does the trick. For readability, you may want to store the lambda function to a variable first, before line 82. |
|
I come across #33931 , while it looks like the PR is stalled it is recommended to use webbrowser over |
sagemathgh-38946: Allow Cython compilation to open a web browser containing the annotated HTML file 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 <!-- Put an `x` in all the boxes that apply. --> - [x] The title is concise and informative. - [x] The description explains in detail what this PR is about. - [x] I have linked a relevant issue or discussion. (not aware of one) - [x] I have created tests covering the changes. - [x] I have updated the documentation and checked the documentation preview. ### Dependencies Depends on sagemath#38945 . URL: sagemath#38946 Reported by: user202729 Reviewer(s): Kwankyu Lee, user202729
sagemathgh-39193: Some improvements to findstat._submit * for some reason the proper header is needed to open the HTML file on my machine. * It's reported that `webbrowser.open()` doesn't work when called on a file path, rather an URI is needed (sagemath#38946) ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> - [x] The title is concise and informative. - [x] The description explains in detail what this PR is about. - [x] I have linked a relevant issue or discussion. - [ ] I have created tests covering the changes. - [x] I have updated the documentation and checked the documentation preview. (not needed) ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on. For example, --> <!-- - sagemath#12345: short description why this is a dependency --> <!-- - sagemath#34567: ... --> URL: sagemath#39193 Reported by: user202729 Reviewer(s): Martin Rubey
sagemathgh-39193: Some improvements to findstat._submit * for some reason the proper header is needed to open the HTML file on my machine. * It's reported that `webbrowser.open()` doesn't work when called on a file path, rather an URI is needed (sagemath#38946) ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> - [x] The title is concise and informative. - [x] The description explains in detail what this PR is about. - [x] I have linked a relevant issue or discussion. - [ ] I have created tests covering the changes. - [x] I have updated the documentation and checked the documentation preview. (not needed) ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on. For example, --> <!-- - sagemath#12345: short description why this is a dependency --> <!-- - sagemath#34567: ... --> URL: sagemath#39193 Reported by: user202729 Reviewer(s): Martin Rubey
|
A test is failing here |
|
Should be fixed in #39282 |
Fixes issue pointed out in sagemath#38946 (comment) ### 📝 Checklist - [x] The title is concise and informative. - [x] The description explains in detail what this PR is about. - [x] I have linked a relevant issue or discussion. - [ ] I have created tests covering the changes. - [ ] I have updated the documentation and checked the documentation preview. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on. For example, --> <!-- - sagemath#12345: short description why this is a dependency --> <!-- - sagemath#34567: ... --> URL: sagemath#39282 Reported by: user202729 Reviewer(s): Frédéric Chapoton
sagemathgh-39282: Fix tests for Python 3.13 Fixes issue pointed out in sagemath#38946 (comment) ### 📝 Checklist - [x] The title is concise and informative. - [x] The description explains in detail what this PR is about. - [x] I have linked a relevant issue or discussion. - [ ] I have created tests covering the changes. - [ ] I have updated the documentation and checked the documentation preview. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on. For example, --> <!-- - sagemath#12345: short description why this is a dependency --> <!-- - sagemath#34567: ... --> URL: sagemath#39282 Reported by: user202729 Reviewer(s): Frédéric Chapoton
sagemathgh-39282: Fix tests for Python 3.13 Fixes issue pointed out in sagemath#38946 (comment) ### 📝 Checklist - [x] The title is concise and informative. - [x] The description explains in detail what this PR is about. - [x] I have linked a relevant issue or discussion. - [ ] I have created tests covering the changes. - [ ] I have updated the documentation and checked the documentation preview. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on. For example, --> <!-- - sagemath#12345: short description why this is a dependency --> <!-- - sagemath#34567: ... --> URL: sagemath#39282 Reported by: user202729 Reviewer(s): Frédéric Chapoton
sagemathgh-39282: Fix tests for Python 3.13 Fixes issue pointed out in sagemath#38946 (comment) ### 📝 Checklist - [x] The title is concise and informative. - [x] The description explains in detail what this PR is about. - [x] I have linked a relevant issue or discussion. - [ ] I have created tests covering the changes. - [ ] I have updated the documentation and checked the documentation preview. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on. For example, --> <!-- - sagemath#12345: short description why this is a dependency --> <!-- - sagemath#34567: ... --> URL: sagemath#39282 Reported by: user202729 Reviewer(s): Frédéric Chapoton
sagemathgh-39282: Fix tests for Python 3.13 Fixes issue pointed out in sagemath#38946 (comment) ### 📝 Checklist - [x] The title is concise and informative. - [x] The description explains in detail what this PR is about. - [x] I have linked a relevant issue or discussion. - [ ] I have created tests covering the changes. - [ ] I have updated the documentation and checked the documentation preview. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on. For example, --> <!-- - sagemath#12345: short description why this is a dependency --> <!-- - sagemath#34567: ... --> URL: sagemath#39282 Reported by: user202729 Reviewer(s): Frédéric Chapoton
sagemathgh-39282: Fix tests for Python 3.13 Fixes issue pointed out in sagemath#38946 (comment) ### 📝 Checklist - [x] The title is concise and informative. - [x] The description explains in detail what this PR is about. - [x] I have linked a relevant issue or discussion. - [ ] I have created tests covering the changes. - [ ] I have updated the documentation and checked the documentation preview. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on. For example, --> <!-- - sagemath#12345: short description why this is a dependency --> <!-- - sagemath#34567: ... --> URL: sagemath#39282 Reported by: user202729 Reviewer(s): Frédéric Chapoton
sagemathgh-39282: Fix tests for Python 3.13 Fixes issue pointed out in sagemath#38946 (comment) ### 📝 Checklist - [x] The title is concise and informative. - [x] The description explains in detail what this PR is about. - [x] I have linked a relevant issue or discussion. - [ ] I have created tests covering the changes. - [ ] I have updated the documentation and checked the documentation preview. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on. For example, --> <!-- - sagemath#12345: short description why this is a dependency --> <!-- - sagemath#34567: ... --> URL: sagemath#39282 Reported by: user202729 Reviewer(s): Frédéric Chapoton
|
This PR leads to an annoying consequence: look at https://doc-pr-39509--sagemath.netlify.app/html/en/reference/misc/sage/misc/cython#hunk1
the address in So far the best way I can think of is to use something like https://stackoverflow.com/questions/6978328/documenting-with-sphinx-python-methods-that-do-have-default-parameters-with-sent to override (the other is to let the default be |
|
Right..
I prefer this approach. I think this is rather a "standard way". You may add an explanation in the docstring to avoid confusion. |
sagemathgh-39621: Fix documentation diff for cython() As discussed in sagemath#38946 (comment) , this hides an irrelevant entry in documentation diff. ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> - [x] The title is concise and informative. - [x] The description explains in detail what this PR is about. - [x] I have linked a relevant issue or discussion. - [ ] I have created tests covering the changes. - [ ] I have updated the documentation and checked the documentation preview. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on. For example, --> <!-- - sagemath#12345: short description why this is a dependency --> <!-- - sagemath#34567: ... --> URL: sagemath#39621 Reported by: user202729 Reviewer(s): Travis Scrimshaw
sagemathgh-39621: Fix documentation diff for cython() As discussed in sagemath#38946 (comment) , this hides an irrelevant entry in documentation diff. ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> - [x] The title is concise and informative. - [x] The description explains in detail what this PR is about. - [x] I have linked a relevant issue or discussion. - [ ] I have created tests covering the changes. - [ ] I have updated the documentation and checked the documentation preview. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on. For example, --> <!-- - sagemath#12345: short description why this is a dependency --> <!-- - sagemath#34567: ... --> URL: sagemath#39621 Reported by: user202729 Reviewer(s): Travis Scrimshaw
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 useswebbrowser.open()anyway?📝 Checklist
Dependencies
Depends on #38945 .