Opened 6 years ago
Closed 6 years ago
#19885 closed defect (fixed)
Jupyter documentation fails for notebooks in subdirectories
Reported by:  vbraun  Owned by:  

Priority:  major  Milestone:  sage7.0 
Component:  notebook  Keywords:  
Cc:  charpent  Merged in:  
Authors:  Volker Braun  Reviewers:  Emmanuel Charpentier 
Report Upstream:  Fixed upstream, but not in a stable release.  Work issues:  
Branch:  65cd4d2 (Commits, GitHub, GitLab)  Commit:  65cd4d288f81ea97c98ed4327a72c28b9dabb1a8 
Dependencies:  Stopgaps: 
Description (last modified by )
Exactly the same as #19469, but for help links.
Steps to reproduce:
 Start sage notebook=jupyter
 In the Jupyter file browser, select New > Folder
 Click on the newlycreated "Untitled Folder" (name does not matter)
 Create a new Sage kernel notebook in this subfolder
 Click on Help > Sage Documentation
Opened URL is http://localhost:8888/notebooks/Untitled%20Folder/kernelspecs/sagemath/doc/index.html
Correct URL would be http://localhost:8888/kernelspecs/sagemath/doc/reference/index.html
Change History (21)
comment:1 Changed 6 years ago by
 Description modified (diff)
comment:2 Changed 6 years ago by
But the SageKernel.help_links
doesn't have a place to add javascript. Sure we could shove it somewhere into the notebook but its somewhat ugly.
An alternative might be to add a Jupyter notebook extension for Sage static files, as it is also useful elsewhere (e.g. mathjax).
comment:3 Changed 6 years ago by
On second thought that still doesn't give the kernel knowledge about the url prefix...
comment:4 Changed 6 years ago by
And there is currently no good way of installing them without mucking with user configuration: https://github.com/jupyter/notebook/issues/878
comment:5 Changed 6 years ago by
Please note, that, with Sage 7.0rc0 :
 I cannot create a subdirectory (I see a message such as
[I 08:41:36.043 NotebookApp] Creating new directory in
(yes, the subdirectory is created ... nowhere !)  Starting
sage n jupyter
in my home directory, creating a new sheeet : I can access the Reference manual.  Navigating to a subdirectory, creating a new worksheet : 404...
 Opening an existing worksheet : 404...
 navigating back to my home directory and opening an existing worksheet : access to the Reference Manual works.
The obvious workaround is to start a notebook server in each work directory. Not inconsiderable loss of functionality, but tolerable.
comment:6 followup: ↓ 8 Changed 6 years ago by
You need to have write permissions in the original directory... which one is it?
comment:7 Changed 6 years ago by
Upstream PR at https://github.com/jupyter/notebook/pull/958
comment:8 in reply to: ↑ 6 Changed 6 years ago by
Replying to vbraun:
You need to have write permissions in the original directory... which one is it?
I suppose that "the original directory" is the directory from where i launched "sage n jupyter". It was my home directory.
comment:9 Changed 6 years ago by
 Branch set to u/vbraun/jupyter_documentation_fails_for_notebooks_in_subdirectories
comment:10 Changed 6 years ago by
 Commit set to 92e10bafea056e47502d762729fc63033da144ae
 Status changed from new to needs_review
New commits:
92e10ba  Fix help_links to work with base_url and notebooks in subdirectories

comment:11 Changed 6 years ago by
 Status changed from needs_review to needs_work
On a small (notebook) machine, running 7.0rc1+Trac#19885 :
Doesn't work for me : starting from my home directory and navigating to ~/Boulot/Bayes/Strat1/
, opening an existing worksheet and trying to access the Sage Reference manual gives me a 404. The browser tries to access http://localhost:8888/notebooks/Boulot/Bayes/Strat1/kernelspecs/sagemath/doc/faq/index.html
.
Note : I just typed "make" (i. e. didn't rebuild the docs, which need more than 30 minutes on this small machine). Does this influence the result ?
needs_work
comment:12 Changed 6 years ago by
 Commit changed from 92e10bafea056e47502d762729fc63033da144ae to 9c5cee2c73109a43af65ccbfe4369fe31485f8fa
Branch pushed to git repo; I updated commit sha1. New commits:
9c5cee2  Update patchlevel

comment:14 Changed 6 years ago by
Works now.
I can't reasonably testlong
on this notebook (takes 58 hours usually...). I'll do that tonight on a "reasonable" machine.
Thank you very much !
comment:15 Changed 6 years ago by
 Status changed from needs_review to needs_work
ptestlong has one failure :
sage t long warnlong 74.3 src/sage/repl/ipython_kernel/kernel.py # 1 doctest failed
However, it's probably a booboo :
charpent@asus16ec:/usr/local/sage7.0$ sage t long warnlong 74.3 src/sage/repl/ipython_kernel/kernel.py Running doctests with ID 2016011521295129b6b7be. Git branch: t/19885/jupyter_documentation_fails_for_notebooks_in_subdirectories Using optional=database_gap,dot2tex,mpir,python2,sage,sage_mode,threejs Doctesting 1 file. sage t long warnlong 74.3 src/sage/repl/ipython_kernel/kernel.py ********************************************************************** File "src/sage/repl/ipython_kernel/kernel.py", line 88, in sage.repl.ipython_kernel.kernel.SageKernel.help_links Failed example: sk.help_links Expected: [{'text': 'Sage Documentation', 'url': '../kernelspecs/sagemath/doc/index.html'}, ...] Got: [{'text': 'Sage Documentation', 'url': 'kernelspecs/sagemath/doc/index.html'}, {'text': 'Sage Tutorial', 'url': 'kernelspecs/sagemath/doc/tutorial/index.html'}, {'text': 'Thematic Tutorials', 'url': 'kernelspecs/sagemath/doc/thematic_tutorials/index.html'}, {'text': 'FAQs', 'url': 'kernelspecs/sagemath/doc/faq/index.html'}, {'text': 'PREP Tutorials', 'url': 'kernelspecs/sagemath/doc/prep/index.html'}, {'text': 'Sage Reference', 'url': 'kernelspecs/sagemath/doc/reference/index.html'}, {'text': "Developer's Guide", 'url': 'kernelspecs/sagemath/doc/developer/index.html'}, {'text': 'Python', 'url': 'http://docs.python.org/2.7'}, {'text': 'IPython', 'url': 'http://ipython.org/documentation.html'}, {'text': 'Singular', 'url': 'http://www.singular.unikl.de/Manual/latest/index.htm'}, {'text': 'GAP', 'url': 'http://gapsystem.org/Manuals/doc/ref/chap0.html'}, {'text': 'NumPy', 'url': 'http://docs.scipy.org/doc/numpy/reference/'}, {'text': 'SciPy', 'url': 'http://docs.scipy.org/doc/scipy/reference/'}, {'text': 'SymPy', 'url': 'http://docs.sympy.org/latest/index.html'}, {'text': 'Matplotlib', 'url': 'http://matplotlib.org/contents.html'}, {'text': 'Markdown', 'url': 'http://help.github.com/articles/githubflavoredmarkdown'}] ********************************************************************** 1 item had failures: 1 of 4 in sage.repl.ipython_kernel.kernel.SageKernel.help_links [8 tests, 1 failure, 0.06 s]  sage t long warnlong 74.3 src/sage/repl/ipython_kernel/kernel.py # 1 doctest failed  Total time for all tests: 0.1 seconds cpu time: 0.1 seconds cumulative wall time: 0.1 seconds
==> needs_work
comment:16 Changed 6 years ago by
 Commit changed from 9c5cee2c73109a43af65ccbfe4369fe31485f8fa to 65cd4d288f81ea97c98ed4327a72c28b9dabb1a8
Branch pushed to git repo; I updated commit sha1. New commits:
65cd4d2  Fix documentation

comment:18 Changed 6 years ago by
 Report Upstream changed from N/A to Fixed upstream, but not in a stable release.
comment:19 Changed 6 years ago by
 Report Upstream changed from Fixed upstream, but not in a stable release. to N/A
 Reviewers set to Emmanuel Charpentier
 Status changed from needs_review to positive_review
 Passes ptestlong with no errors
 Works as advertised
==>positive_review
comment:20 Changed 6 years ago by
 Report Upstream changed from N/A to Fixed upstream, but not in a stable release.
comment:21 Changed 6 years ago by
 Branch changed from u/vbraun/jupyter_documentation_fails_for_notebooks_in_subdirectories to 65cd4d288f81ea97c98ed4327a72c28b9dabb1a8
 Resolution set to fixed
 Status changed from positive_review to closed
This should be trivial to fix for somebody who knows javascript (i.e. not me). That javascript should determine whether the help link is relative and prepend
base_url
if it is.