Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jupyter documentation fails for notebooks in subdirectories #19885

Closed
vbraun opened this issue Jan 13, 2016 · 28 comments
Closed

Jupyter documentation fails for notebooks in subdirectories #19885

vbraun opened this issue Jan 13, 2016 · 28 comments

Comments

@vbraun
Copy link
Member

vbraun commented Jan 13, 2016

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

Upstream: Fixed upstream, but not in a stable release.

CC: @EmmanuelCharpentier

Component: notebook

Author: Volker Braun

Branch/Commit: 65cd4d2

Reviewer: Emmanuel Charpentier

Issue created by migration from https://trac.sagemath.org/ticket/19885

@vbraun vbraun added this to the sage-7.0 milestone Jan 13, 2016
@jdemeyer
Copy link

comment:1

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.

@jdemeyer

This comment has been minimized.

@vbraun
Copy link
Member Author

vbraun commented Jan 13, 2016

comment:2

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).

@vbraun
Copy link
Member Author

vbraun commented Jan 14, 2016

comment:3

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

@vbraun
Copy link
Member Author

vbraun commented Jan 14, 2016

comment:4

And there is currently no good way of installing them without mucking with user configuration: jupyter/notebook#878

@EmmanuelCharpentier
Copy link
Mannequin

EmmanuelCharpentier mannequin commented Jan 14, 2016

comment:5

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.

@vbraun
Copy link
Member Author

vbraun commented Jan 14, 2016

comment:6

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

@vbraun
Copy link
Member Author

vbraun commented Jan 15, 2016

comment:7

Upstream PR at jupyter/notebook#958

@EmmanuelCharpentier
Copy link
Mannequin

EmmanuelCharpentier mannequin commented Jan 15, 2016

comment:8

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.

@vbraun
Copy link
Member Author

vbraun commented Jan 15, 2016

@vbraun
Copy link
Member Author

vbraun commented Jan 15, 2016

New commits:

92e10baFix help_links to work with base_url and notebooks in subdirectories

@vbraun
Copy link
Member Author

vbraun commented Jan 15, 2016

Commit: 92e10ba

@vbraun
Copy link
Member Author

vbraun commented Jan 15, 2016

Author: Volker Braun

@EmmanuelCharpentier
Copy link
Mannequin

EmmanuelCharpentier mannequin commented Jan 15, 2016

comment:11

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

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jan 15, 2016

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

9c5cee2Update patchlevel

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jan 15, 2016

Changed commit from 92e10ba to 9c5cee2

@vbraun
Copy link
Member Author

vbraun commented Jan 15, 2016

comment:13

Try again

@EmmanuelCharpentier
Copy link
Mannequin

EmmanuelCharpentier mannequin commented Jan 15, 2016

comment:14

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 !

@EmmanuelCharpentier
Copy link
Mannequin

EmmanuelCharpentier mannequin commented Jan 15, 2016

comment:15

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

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jan 15, 2016

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

65cd4d2Fix documentation

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jan 15, 2016

Changed commit from 9c5cee2 to 65cd4d2

@vbraun
Copy link
Member Author

vbraun commented Jan 15, 2016

comment:17

fixed

@vbraun
Copy link
Member Author

vbraun commented Jan 15, 2016

Upstream: Fixed upstream, but not in a stable release.

@EmmanuelCharpentier
Copy link
Mannequin

EmmanuelCharpentier mannequin commented Jan 15, 2016

Reviewer: Emmanuel Charpentier

@EmmanuelCharpentier
Copy link
Mannequin

EmmanuelCharpentier mannequin commented Jan 15, 2016

Changed upstream from Fixed upstream, but not in a stable release. to none

@EmmanuelCharpentier
Copy link
Mannequin

EmmanuelCharpentier mannequin commented Jan 15, 2016

comment:19
  • Passes ptestlong with no errors

  • Works as advertised

==>positive_review

@vbraun
Copy link
Member Author

vbraun commented Jan 15, 2016

Upstream: Fixed upstream, but not in a stable release.

@vbraun
Copy link
Member Author

vbraun commented Jan 20, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants