-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
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
DOC: Use nbsphinx #15581
DOC: Use nbsphinx #15581
Conversation
Why does it need pandoc? You also included two versions of the notebook, was that on purpose? But seems to look much nicer! |
Codecov Report
@@ Coverage Diff @@
## master #15581 +/- ##
=======================================
Coverage 90.99% 90.99%
=======================================
Files 145 145
Lines 49565 49565
=======================================
Hits 45101 45101
Misses 4464 4464
Continue to review full report at Codecov.
|
Oh, I think it's the same as nbconvert, so nothing new.
Nope, fixed.
We had the dummy |
@TomAugspurger you need to add the install of |
ci/install_travis.sh
Outdated
@@ -114,6 +114,10 @@ if [ "$COVERAGE" ]; then | |||
pip install coverage pytest-cov | |||
fi | |||
|
|||
if [ "$DOC_BUILD" ]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move instead to ci/requirements-3.5_DOC_BUILD.sh
(and I would install install via conda-forge channel (just like feather-format)
@@ -81,7 +81,9 @@ have ``sphinx`` and ``ipython`` installed. `numpydoc | |||
<https://github.com/numpy/numpydoc>`_ is used to parse the docstrings that | |||
follow the Numpy Docstring Standard (see above), but you don't need to install | |||
this because a local copy of ``numpydoc`` is included in the pandas source | |||
code. | |||
code. `nbsphinx <https://nbsphinx.readthedocs.io/>`_ is used to convert | |||
Jupyter notebooks. You will need to install it if you intend to modify any of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should prob add this to the requirements_docs (which should also have conda-forge as a channel in the instructions)
Fixed, thanks. Also added seaborn to the doc build (used in the notebook). I set the option to allow errors when executing the notebook, as that seems more consistent with the rest of the doc build. |
@TomAugspurger doc build is failing on travis due to missing pandoc. So apparently this was previously not needed. |
@@ -321,3 +321,27 @@ div.seealso dd { | |||
margin-top: 0; | |||
margin-bottom: 0; | |||
} | |||
|
|||
table { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is some styling for rendered_html tables above. Should that then be removed? (I think that was added for the converted styling notebook)
Also, would this also influence the tables in the other docs? So maybe this should have a 'dataframe' selector?
@@ -3,6 +3,7 @@ pytest-cov | |||
pytest-xdist | |||
flake8 | |||
sphinx |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm, is this our catch all for what people should install to get a dev env? should add seaborn then
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We also have requirements_dev.txt
, which I think is more appropriate. I read requirements_all.txt
as all the optional deps for using pandas (xlrd, xlwt, tables, etc.). Maybe sphinx
and the test libs should go in requirements_dev.txt
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah I think these should be more clear what the purpose of these are. You can add a comment (or 2) at the top of the file I think (# is ignored)
I'd rather not have pandoc as a required dependency to build the docs. I'll see what I can do to make this fail gracefully without pandoc installed. |
Previously, we were using nbconvert to just convert it to html, which did not needed pandoc. But with nbsphinx I suppose this converts it to rst under the hood and therefore uses pandoc? (not sure if that is a correct assessment, the docs of nbsphinx are not very clear on the pandoc requirement in their installation notes) But indeed, it would be nice that this would not fail the doc build if you do that locally without having pandoc installed. EDIT: ah, this last thing was the point you were making I suppose :-) |
999f77b
to
0033aa7
Compare
this lgtm. @jorisvandenbossche had some comments though. |
Oh, whoops, forgot I had already made a merge request. I'll let you know when this is ready for review. Quick update though: I raised an issue on nbsphinx about gracefully failing if there's no pandoc. I think they're open, but 1.) they have a stalled PR removing the need for pandoc entirely, and 2.) it's a bit tricky since the errors are raised on each markdown cell (do you skip the cell, or the entire nb?) So I think it's probably best we just workaround it for now by removing the ipynb file(s) before calling out to sphinx. Also, should we do something like my |
Are people OK with using Pip let's you source additional requirements files from another like so
Does anyone know if this is possible with conda? If not I'll open an issue requesting it. |
Reading a bit more, it seems like One additional option is
And then the conda install instructions are conda env create -n pandas_dev python=3 -f ci/requirements_base.txt
conda install -n pandas_dev --file=ci/requirements_all.txt
conda install -n pandas_dev --file=ci/requirements_dev.txt
[source] activate pandas_dev |
should also have a requirements_docs.txt I think (with only the doc-stuff). |
Looks like conda is close to allowing |
ci/requirements-3.5_DOC_BUILD.sh
Outdated
@@ -6,6 +6,6 @@ echo "[install DOC_BUILD deps]" | |||
|
|||
pip install pandas-gbq | |||
|
|||
conda install -n pandas -c conda-forge feather-format | |||
conda install -n pandas -c conda-forge feather-format nbsphinx pypandoc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you need pypandoc
for?
Wouldn't pandoc
be more appropriate instead?
https://anaconda.org/conda-forge/pandoc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whoops, your correct. I forgot they were packaged separately. Will update.
yield | ||
for nb, content in contents.items(): | ||
with open(nb, 'wt') as f: | ||
f.write(content) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Am I seeing correctly that you are writing the file(s) each time after Sphinx is run?
This will force re-parsing each time you run it again ...
Otherwise, Sphinx would simply skip over the already built (and up-to-date) notebooks.
Also, if somebody is editing the notebook(s) at the same time, this might cause problems, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Am I seeing correctly that you are writing the file(s) each time after Sphinx is run?
If nbsphinx is installed then contents
will be empty. So we should only be writing stuff if nbsphinx
is not installed, and sphinx isn't parsing these files anyway.
For editing the notebooks at the same time, I don't think there are any additional problems with this approach.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I see now. It still seems a bit brutal to me and I'm generally skeptical about writing to the source directory, but I guess it's OK.
Yes, this is correct. At least until spatialaudio/nbsphinx#36 is done (which is a biggie). You are also right that the documentation doesn't mention that, but we had at least an issue for that: spatialaudio/nbsphinx#72. Looking forward to Jupyter notebooks in the |
|
||
div.seealso dd { | ||
margin-top: 0; | ||
margin-bottom: 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this have been removed? (not sure if it does something useful)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mmm probably an accident on my part. I'll push a fix (the rendered_html removal was intentional).
@@ -52,14 +52,16 @@ | |||
'numpydoc', # used to parse numpy-style docstrings for autodoc | |||
'ipython_sphinxext.ipython_directive', | |||
'ipython_sphinxext.ipython_console_highlighting', | |||
'IPython.sphinxext.ipython_console_highlighting', # lowercase didn't work |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note there is a difference here in _
vs .
. The one already present with the _
is our vendored version (and the directory is with lower case, so that works). What was the reason you needed this?
(although we should maybe migrate to just use IPython itself instead of our own version, but should look again at why we exactly were doing this)
can you rebase (happy to push this in as well if you are ready) |
Rebased.
What was the reason you needed this?
Otherwise we got a bunch of warnings about the IPython lever not being
installed.
Ideally, we wouldn't need it but there's an issue with how anaconda
installs the notebook [apparently](
spatialaudio/nbsphinx#24).
…On Wed, Mar 29, 2017 at 2:38 PM, Jeff Reback ***@***.***> wrote:
can you rebase (happy to push this in as well if you are ready)
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#15581 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABQHIj1JBV4z31ZJdGmrnmk1rHtrhTRdks5rqrMxgaJpZM4MTfzT>
.
|
the Jupyter notebooks included in the documentation. | ||
|
||
If you have a conda environment named ``pandas_dev``, you can install the extra | ||
requirements with:: | ||
|
||
conda install -n pandas_dev sphinx ipython nbconvert nbformat | ||
conda install -n pandas_dev -c conda-forge nbsphinx |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should just always add -c conda-forge
(as defaults is always added), and things just work
@TomAugspurger merge? (minor comment on the installation of libs). |
ready for merge? |
Going to wait a day or two to see if #14757 is updated, since there will be a notebook conflict. |
sure |
Adds a new doc-dependency nbsphinx for converting jupyter notebooks to ReST, which works better with the sphinx conversion process. Remvoes the hacky notebook -> HTML -> raw include we had before.
nice @TomAugspurger couple of comments on the built docs: http://pandas-docs.github.io/pandas-docs-travis/style.html
|
Followup to pandas-dev#15581 Using the `nbsphinx: hidden` metadata to hide the ouptut, so readers don't see matplotlib's fc-list warning. Make the tables monospaced in CSS.
Followup to pandas-dev#15581 Using the `nbsphinx: hidden` metadata to hide the ouptut, so readers don't see matplotlib's fc-list warning. Make the tables monospaced in CSS.
Followup to #15581 Using the `nbsphinx: hidden` metadata to hide the ouptut, so readers don't see matplotlib's fc-list warning. Make the tables monospaced in CSS.
The documentation built with nbsphinx uses a different font to the rest of the docs, i.e. a serif font. |
Whoops, that's on me. Actually comes from my #15954 PR. I'll put up a fix. Thanks. |
This was overriding the CSS on the rest of the page. Reported in pandas-dev#15581 (comment) Also inlines the CSS from our theme. [ci skip]
This was overriding the CSS on the rest of the page. Reported in #15581 (comment) Also inlines the CSS from our theme. [ci skip]
When switching to nbsphinx, I modified the site's CSS so that the converted notebook looks decent. This had some unfortunate changes on tables elsewhere in the notebook. This change fixes the headers to be left-aligned in the main site, and right-aligned for the tables generated by `df.style` in the nbsphinx-converted notebook. xref pandas-dev#15581
When switching to nbsphinx, I modified the site's CSS so that the converted notebook looks decent. This had some unfortunate changes on tables elsewhere in the notebook. This change fixes the headers to be left-aligned in the main site, and right-aligned for the tables generated by `df.style` in the nbsphinx-converted notebook. xref #15581
This was overriding the CSS on the rest of the page. Reported in pandas-dev#15581 (comment) Also inlines the CSS from our theme. [ci skip]
When switching to nbsphinx, I modified the site's CSS so that the converted notebook looks decent. This had some unfortunate changes on tables elsewhere in the notebook. This change fixes the headers to be left-aligned in the main site, and right-aligned for the tables generated by `df.style` in the nbsphinx-converted notebook. xref pandas-dev#15581
Update header levels for nbsphinx
Link to nb, nicer default table
Closes #15539