Enable Jupyter Sphinx Extension in docs?
See original GitHub issueWhile writing documentation, I noticed the extended use of the IPython Sphinx Directive.
I bet most pvlib users like to play with pvlib in interactive environments. However, I think Jupyter Notebooks are getting more common/widespread when compared to IPython consoles. I wondered if it would be acceptable to allow code in the documentation to look more like notebooks instead of consoles.
There is this extension called Jupyter Sphinx, under the umbrella of the Jupyter organization.
I think it could have a couple of advantages:
- Simpler code (i.e.: no need to
@savefig
) - Removal of
In [xx]:
, which makes it harder to read, copy and paste - Easier to read, since blank lines are honored in the code
- More similarities to a Jupyter notebook (so maybe more user-friendly for readers)
- Allows to hide input/output
- Allows to download as a Notebook or Python script
- Allows to emphasize lines in a cell (very useful when wanting to highlight something in the documentation)
- The style can be tweaked to, for example, remove the box shadows (to avoid changing too much the current looks of the docs)
- Allows for interactive plots with Plotly, and Pandas has a Plotly backend, so it would be very easy to have interactive plots in the documentation without adding clutter nor assuming readers need to know about Plotly/Matplotlib
A couple of (maybe) disadvantages:
- Not sure PDF (i.e.: LaTeX) export would work when using interactive plots
- ipywidgets would definitely be not rendered in PDF (https://github.com/jupyter/jupyter-sphinx/issues/61)
??
does not work (only used inmodelchain.rst
); see https://github.com/jupyter/nbclient/issues/196 (maybe replaceable bysphinx-code-include
)- Add more development dependencies (if both IPython and Jupyter were to be allowed)
- Required migration (if Jupyter was to replace IPython completely)
- Performance may be slower?
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:7 (7 by maintainers)
Top Results From Across the Web
How to use Jupyter notebooks in Sphinx - Read the Docs
There are a few extensions that allow integrating Jupyter and Sphinx, and this document will explain how to achieve some of the most...
Read more >Sphinx extension for rendering of Jupyter interactive widgets.
jupyter -sphinx enables running code embedded in Sphinx documentation and embedding output of that code into the resulting document. It has support for...
Read more >How Jupyter Book and Sphinx relate to one another
Sphinx primarily uses a markup language called reStructuredText to write documents. This is similar to markdown, though is less-popular and more flexible. In ......
Read more >Integrating output in documentation with jupyter-sphinx
We have just made an addition to this list, a freshly rewritten jupyter-sphinx extension, that was previously specialized to render Jupyter ...
Read more >jupyter-sphinx - PyPI
Jupyter Sphinx Extensions ... jupyter-sphinx enables running code embedded in Sphinx documentation and embedding output of that code into the resulting document.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@wholmgren It’s true that the directive had 3 commits in the last 2 years, and the documentation still states:
jupyter-sphinx
seems to be a bit more active and there does not seem to be a “beta” statement in the docs.PS: Cross-referencing https://github.com/jupyter/jupyter-sphinx/issues/36.
Thanks for the thorough summary @Peque! Just to have something to look at, here’s the result of naively replacing ipython w/ jupyter-execute:
Of course blocks of code with multiple outputs only show the last output now, so a little restructuring would be needed. Also, it seems like
??
doesn’t work?