Skip to content

Commit 74f244c

Browse files
author
Release Manager
committed
sagemathgh-38005: Fix Help menu breakdown in external jupyterlab case <!-- ^ Please provide a concise and informative title. --> <!-- ^ Don't put issue numbers in the title, do this in the PR description below. --> <!-- ^ For example, instead of "Fixes sagemath#12345" use "Introduce new method to calculate 1 + 2". --> <!-- v Describe your changes below in detail. --> <!-- v Why is this change required? What problem does it solve? --> <!-- v If this PR resolves an open issue, please link to it here. For example, "Fixes sagemath#12345". --> sagemath#37878 introduced a local documentation server for jupyterlab. But it missed a case for which the Help menu of jupyterlab may break down. In the setup explained in https://doc.sagemath.org/html/en/installation/launching.html#setting-up- sagemath-as-a-jupyter-kernel-in-an-existing-jupyter-notebook-or- jupyterlab-installation, external jupyterlab is launched and connected to sage kernel. In this case, the local doc server does not run, but the Help menu of the jupyterlab still expects a local doc server, and thus the Help menu does not work well. In this PR, local doc server is detected by testing the port number, and the Help menu uses the online official documentation if local doc server is not running. ### 📝 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#38005 Reported by: Kwankyu Lee Reviewer(s):
2 parents bcf2709 + def978a commit 74f244c

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/sage/repl/ipython_kernel/kernel.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,14 +108,13 @@ def help_links(self):
108108
# src/bin/sage-notebook.
109109

110110
from sage.env import SAGE_DOC_SERVER_URL
111+
from sage.env import SAGE_DOC_LOCAL_PORT as port
111112
from sage.features.sagemath import sagemath_doc_html
112113

113114
if SAGE_DOC_SERVER_URL:
114115
def doc_url(path):
115116
return f'{SAGE_DOC_SERVER_URL}/{path}'
116-
elif sagemath_doc_html().is_present():
117-
from sage.env import SAGE_DOC_LOCAL_PORT as port
118-
117+
elif sagemath_doc_html().is_present() and int(port):
119118
def doc_url(path):
120119
return f'http://127.0.0.1:{port}/{path}'
121120
else:

0 commit comments

Comments
 (0)