You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
docs: Generate notebook outputs for web display #268
Currently, we do not show notebook outputs. It would be helpful to do so. However, we do not want to store the outputs in Git because they pollute diffs.
We should investigate the solution used by Scikit-learn:
I think Sphinx-gallery, the solution used by Scikit-learn is not ideal, as discussed in PR #270, where I was trying to use it.
Instead, I think we should use a solution that works directly with Jupyter notebooks, without converters, potentially Nbsphinx: https://github.com/spatialaudio/nbsphinx
nbsphinx seems to want notebooks in toctree directives rather than ..include directives in the rst files. Using relative paths in ..include works fine to find notebooks under examples but sphinx tries to process them as rst files. Using relative paths under toctree seems to not find anything above docs. As per http://www.sphinx-doc.org/en/1.5.1/markup/toctree.html, Relative document names (not beginning with a slash) are relative to the document the directive occurs in, absolute names are relative to the source directory. This sounds like relative paths with .. should work but sensible things like ../examples/test or /examples/test or examples/test don't seem to work. An easy but hacky workaround is symlinking examples inside docs during the build process (something we can do in the makefile). I'm open to better options here.
With examples symlinked under docs, we run into another issue, which is that notebook rendering doesn't seem to respect environments. We need to figure out a way to tell nbsphinx which nbconvert to use (which should be the one that is in the env that the builder itself created).
I tested it and it works fine. Before submitting a PR, I need to figure out how to separate documentation building from unit testing, because it will not be feasible to run them together anymore.
MyST-NB is a recent project for executing notebooks in Sphinx. It also works in my simple testing. One advantage over nbsphinx is that it does not depend on Pandoc (which is large and not on PyPI). However, it does not appear to support notebooks outside the Sphinx root: executablebooks/MyST-NB#297
Activity
docs: Use sphinx-gallery
docs: Use sphinx-gallery
docs: Use sphinx-gallery
bug fix on printing exception traceback (#268)
mihaic commentedon Feb 27, 2018
I think Sphinx-gallery, the solution used by Scikit-learn is not ideal, as discussed in PR #270, where I was trying to use it.
Instead, I think we should use a solution that works directly with Jupyter notebooks, without converters, potentially Nbsphinx:
https://github.com/spatialaudio/nbsphinx
mshvartsman commentedon Apr 23, 2018
I did some poking at this, but it is (unfortunately) not trivial. WIP in https://github.com/mshvartsman/brainiak/tree/nbsphinx. There's a few issues keeping this from working:
nbsphinx seems to want notebooks in
toctreedirectives rather than..includedirectives in the rst files. Using relative paths in..includeworks fine to find notebooks underexamplesbut sphinx tries to process them as rst files. Using relative paths undertoctreeseems to not find anything abovedocs. As per http://www.sphinx-doc.org/en/1.5.1/markup/toctree.html,Relative document names (not beginning with a slash) are relative to the document the directive occurs in, absolute names are relative to the source directory.This sounds like relative paths with..should work but sensible things like../examples/testor/examples/testorexamples/testdon't seem to work. An easy but hacky workaround is symlinking examples inside docs during the build process (something we can do in the makefile). I'm open to better options here.With
examplessymlinked underdocs, we run into another issue, which is that notebook rendering doesn't seem to respect environments. We need to figure out a way to tell nbsphinx whichnbconvertto use (which should be the one that is in the env that the builder itself created).mihaic commentedon Apr 15, 2021
I found a plugin that allows nbsphinx to use notebooks outside
docs:https://github.com/vidartf/nbsphinx-link
I tested it and it works fine. Before submitting a PR, I need to figure out how to separate documentation building from unit testing, because it will not be feasible to run them together anymore.
mihaic commentedon Apr 15, 2021
MyST-NB is a recent project for executing notebooks in Sphinx. It also works in my simple testing. One advantage over nbsphinx is that it does not depend on Pandoc (which is large and not on PyPI). However, it does not appear to support notebooks outside the Sphinx root:
executablebooks/MyST-NB#297
mihaic commentedon May 28, 2021
We ended up going with MyST-NB and it seems to be going well:
https://github.com/brainiak/brainiak/runs/2689575413?check_suite_focus=true#step:6:938
I will leave this issue open until we integrate all the existing notebooks.