Skip to content

Commit b42b381

Browse files
author
Release Manager
committed
gh-36246: Use URLs to online Sage documents for JupyterLab <!-- ^^^^^ Please provide a concise, informative and self-explanatory title. Don't put issue numbers in there, do this in the PR body below. For example, instead of "Fixes #1234" use "Introduce new method to calculate 1+1" --> <!-- Describe your changes here in detail --> Sage documents in the Help menu of JupyterLab have stopped working for long time. Those are essentially links to local files, but they don't work for JupyterLab. We replace them with URLs to online documents, to make them functional again. <!-- Why is this change required? What problem does it solve? --> <!-- If this PR resolves an open issue, please link to it here. For example "Fixes #12345". --> <!-- If your change requires a documentation PR, please link it appropriately. --> ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> <!-- If your change requires a documentation PR, please link it appropriately --> <!-- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> <!-- Feel free to remove irrelevant items. --> - [x] The title is concise, informative, and self-explanatory. - [x] The description explains in detail what this PR is about. - [ ] I have linked a relevant issue or discussion. - [ ] I have created tests covering the changes. - [ ] I have updated the documentation accordingly. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on - #12345: short description why this is a dependency - #34567: ... --> <!-- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> URL: #36246 Reported by: Kwankyu Lee Reviewer(s): Eric Gourgoulhon
2 parents c59ebbb + 39a53cc commit b42b381

File tree

1 file changed

+29
-15
lines changed

1 file changed

+29
-15
lines changed

src/sage/repl/ipython_kernel/kernel.py

Lines changed: 29 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -94,54 +94,68 @@ def help_links(self):
9494
9595
See the Jupyter documentation.
9696
97-
.. NOTE::
98-
99-
Urls starting with "kernelspecs" are prepended by the
100-
browser with the appropriate path.
101-
10297
EXAMPLES::
10398
10499
sage: from sage.repl.ipython_kernel.kernel import SageKernel
105100
sage: sk = SageKernel.__new__(SageKernel)
106101
sage: sk.help_links
107102
[{'text': 'Sage Documentation',
108-
'url': 'kernelspecs/sagemath/doc/html/en/index.html'},
103+
'url': 'https://doc.sagemath.org/html/en/index.html'},
109104
...]
110105
"""
106+
# DEPRECATED: The URLs in the form 'kernelspecs/...' were used for
107+
# classical Jupyter notebooks. For instance,
108+
#
109+
# 'kernelspecs/sagemath/doc/html/en/index.html'
110+
#
111+
# is constructed by kernel_url('doc/html/en/index.html'), but these
112+
# URLs of local files don't work for JupyterLab. Hence all URLs here
113+
# have been replaced with URLs of online documents.
114+
111115
from sage.repl.ipython_kernel.install import SageKernelSpec
112116
identifier = SageKernelSpec.identifier()
113117

114118
def kernel_url(x):
119+
# URLs starting with 'kernelspecs' are prepended by the
120+
# browser with the appropriate path
115121
return 'kernelspecs/{0}/{1}'.format(identifier, x)
116122

117123
return [
118124
{
119125
'text': 'Sage Documentation',
120-
'url': kernel_url('doc/html/en/index.html'),
126+
'url': "https://doc.sagemath.org/html/en/index.html",
127+
},
128+
{
129+
'text': 'A Tour of Sage',
130+
'url': "https://doc.sagemath.org/html/en/a_tour_of_sage/index.html",
121131
},
122132
{
123133
'text': 'Tutorial',
124-
'url': kernel_url('doc/html/en/tutorial/index.html'),
134+
'url': "https://doc.sagemath.org/html/en/tutorial/index.html",
125135
},
126136
{
127137
'text': 'Thematic Tutorials',
128-
'url': kernel_url('doc/html/en/thematic_tutorials/index.html'),
138+
'url': "https://doc.sagemath.org/html/en/thematic_tutorials/index.html",
129139
},
130140
{
131-
'text': 'FAQs',
132-
'url': kernel_url('doc/html/en/faq/index.html'),
141+
'text': 'PREP Tutorials',
142+
'url': "https://doc.sagemath.org/html/en/prep/index.html",
133143
},
134144
{
135-
'text': 'PREP Tutorials',
136-
'url': kernel_url('doc/html/en/prep/index.html'),
145+
'text': 'Constructions',
146+
'url': "https://doc.sagemath.org/html/en/constructions/index.html",
147+
},
148+
{
149+
'text': 'FAQ',
150+
'url': "https://doc.sagemath.org/html/en/faq/index.html",
137151
},
138152
{
139153
'text': 'Reference',
140-
'url': kernel_url('doc/html/en/reference/index.html'),
154+
'url': "https://doc.sagemath.org/html/en/reference/index.html",
141155
},
142156
{
143157
'text': "Developer's Guide",
144-
'url': kernel_url('doc/html/en/developer/index.html'),
158+
'url': "https://doc.sagemath.org/html/en/developer/index.html",
145159
},
146160
{
147161
'text': "Python",

0 commit comments

Comments
 (0)