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: sage-7.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:

Status badges

Description (last modified by jdemeyer)

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 newly-created "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 jdemeyer

  • Description modified (diff)

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.

comment:2 Changed 6 years ago by vbraun

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 vbraun

On second thought that still doesn't give the kernel knowledge about the url prefix...

comment:4 Changed 6 years ago by vbraun

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 charpent

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 follow-up: Changed 6 years ago by vbraun

You need to have write permissions in the original directory... which one is it?

comment:8 in reply to: ↑ 6 Changed 6 years ago by charpent

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.

Last edited 6 years ago by charpent (previous) (diff)

comment:9 Changed 6 years ago by vbraun

  • Branch set to u/vbraun/jupyter_documentation_fails_for_notebooks_in_subdirectories

comment:10 Changed 6 years ago by vbraun

  • Authors set to Volker Braun
  • Commit set to 92e10bafea056e47502d762729fc63033da144ae
  • Status changed from new to needs_review

New commits:

92e10baFix help_links to work with base_url and notebooks in subdirectories

comment:11 Changed 6 years ago by charpent

  • 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 git

  • Commit changed from 92e10bafea056e47502d762729fc63033da144ae to 9c5cee2c73109a43af65ccbfe4369fe31485f8fa

Branch pushed to git repo; I updated commit sha1. New commits:

9c5cee2Update patchlevel

comment:13 Changed 6 years ago by vbraun

  • Status changed from needs_work to needs_review

Try again

comment:14 Changed 6 years ago by charpent

Works now.

I can't reasonably testlong on this notebook (takes 5-8 hours usually...). I'll do that tonight on a "reasonable" machine.

Thank you very much !

comment:15 Changed 6 years ago by charpent

  • Status changed from needs_review to needs_work

ptestlong has one failure :

sage -t --long --warn-long 74.3 src/sage/repl/ipython_kernel/kernel.py  # 1 doctest failed

However, it's probably a booboo :

charpent@asus16-ec:/usr/local/sage-7.0$ sage -t --long --warn-long 74.3 src/sage/repl/ipython_kernel/kernel.py
Running doctests with ID 2016-01-15-21-29-51-29b6b7be.
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 --warn-long 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.uni-kl.de/Manual/latest/index.htm'},
     {'text': 'GAP', 'url': 'http://gap-system.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/github-flavored-markdown'}]
**********************************************************************
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 --warn-long 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 git

  • Commit changed from 9c5cee2c73109a43af65ccbfe4369fe31485f8fa to 65cd4d288f81ea97c98ed4327a72c28b9dabb1a8

Branch pushed to git repo; I updated commit sha1. New commits:

65cd4d2Fix documentation

comment:17 Changed 6 years ago by vbraun

  • Status changed from needs_work to needs_review

fixed

comment:18 Changed 6 years ago by vbraun

  • Report Upstream changed from N/A to Fixed upstream, but not in a stable release.

comment:19 Changed 6 years ago by charpent

  • 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 vbraun

  • Report Upstream changed from N/A to Fixed upstream, but not in a stable release.

comment:21 Changed 6 years ago by vbraun

  • 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
Note: See TracTickets for help on using tickets.