Description
Summary: proposal to not maintain our own version of Sphinx extension in pandas repo but instead use the extensions directly from the project it maintains.
The pandas docs are using some Sphinx extensions that are not included in Sphinx itself: numpydoc
and ipythons ipython_directive
and ipython_console_highlighting
(also matplotlibs plot_directive
is imported in conf.py, but this is not included in the pandas repo).
These extension are located here: https://github.com/pydata/pandas/tree/master/doc/sphinxext.
I think that ideally pandas does not have to care about them, but just uses them by importing the extension from the respective project it lives under (numpy/ipython).
Some recent issue with the doc building also arised form outdated versions of these extensions in pandas repo (see part of the commits in PR #5160 and #4165).
The original extensions are living here:
- ipython sphinxext in ipython itself: https://github.com/ipython/ipython/tree/master/IPython/sphinxext
- numpydoc in its own repo: https://github.com/numpy/numpydoc
Options we could do:
- ipython extensions can just be imported from there in conf.py (because ipython is already a dependency)
- numpydoc could be added as a submodule (this is how eg numpy itself does it: https://github.com/numpy/numpy/tree/master/doc, 'sphinxext' links to numpydoc), or it can be added as a doc build dependency.
Possible problems with this is that the version in the pandas repo has converged from the version in numpy/ipython:
- I think for
numpydoc
this will not be a problem. Following the history it was updated 3 years ago, and then only recently for python 3 compatibility. - For
ipython_directive
this seems more of a problem, looking at the history: https://github.com/pydata/pandas/commits/master/doc/sphinxext/ipython_directive.py there seems to be work done on this specifically for the pandas docs. If this is the case that is has converged from the ipython one, then ideally this could be contributed back to ipython (if the feature is not available there), but this will be more work to adapt.