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

DOC: Doc build for a single doc made much faster, and clean up #24428

Merged
merged 13 commits into from
Dec 30, 2018
Merged

DOC: Doc build for a single doc made much faster, and clean up #24428

merged 13 commits into from
Dec 30, 2018

Conversation

datapythonista
Copy link
Member

The main goal of this PR is to be able to build single pages faster and without building anything else, so detecting and fixing the warnings (and other problems) in doc pages should be much more efficient.

Additionally, those things have been addressed:

  • Addressing technical debt in the doc build
  • Moved stuff (like rendering index.rst.template) from doc/make.py to doc/source/conf.py, which makes things simpler, and makes it possible to call sphinx-build directly
  • When --single is used, do not build anything else than the required page (before all whatsnew pages where additionally build), which makes it much faster
  • Added option to fail the doc build if warnings are found (cancelling the build immediately)

@jorisvandenbossche can you take a look please?

import inspect
import importlib
import logging
import warnings

import jinja2
from sphinx.ext.autosummary import _import_by_name
from numpydoc.docscrape import NumpyDocString
from numpydoc.docscrape_sphinx import SphinxDocString
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can remove the raw_input yes? as we only build on py3 now?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point, and actually it wasn't used, so should still run in py2

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right, its actualy totally fine to have only py3 doc building now.

@codecov
Copy link

codecov bot commented Dec 26, 2018

Codecov Report

Merging #24428 into master will decrease coverage by 49.29%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #24428      +/-   ##
==========================================
- Coverage    92.3%      43%   -49.3%     
==========================================
  Files         163      163              
  Lines       51966    51966              
==========================================
- Hits        47967    22349   -25618     
- Misses       3999    29617   +25618
Flag Coverage Δ
#multiple ?
#single 43% <ø> (ø) ⬆️
Impacted Files Coverage Δ
pandas/io/formats/latex.py 0% <0%> (-100%) ⬇️
pandas/core/categorical.py 0% <0%> (-100%) ⬇️
pandas/io/sas/sas_constants.py 0% <0%> (-100%) ⬇️
pandas/tseries/plotting.py 0% <0%> (-100%) ⬇️
pandas/tseries/converter.py 0% <0%> (-100%) ⬇️
pandas/io/formats/html.py 0% <0%> (-98.65%) ⬇️
pandas/core/groupby/categorical.py 0% <0%> (-95.46%) ⬇️
pandas/io/sas/sas7bdat.py 0% <0%> (-91.17%) ⬇️
pandas/io/sas/sas_xport.py 0% <0%> (-90.15%) ⬇️
pandas/core/tools/numeric.py 10.44% <0%> (-89.56%) ⬇️
... and 121 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1905485...c489aa6. Read the comment docs.

@codecov
Copy link

codecov bot commented Dec 26, 2018

Codecov Report

Merging #24428 into master will increase coverage by 0.02%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #24428      +/-   ##
==========================================
+ Coverage    92.3%   92.32%   +0.02%     
==========================================
  Files         163      166       +3     
  Lines       51969    52328     +359     
==========================================
+ Hits        47968    48310     +342     
- Misses       4001     4018      +17
Flag Coverage Δ
#multiple 90.74% <ø> (+0.03%) ⬆️
#single 43.04% <ø> (+0.03%) ⬆️
Impacted Files Coverage Δ
pandas/core/dtypes/cast.py 88.72% <0%> (-0.67%) ⬇️
pandas/core/arrays/datetimelike.py 95.66% <0%> (-0.28%) ⬇️
pandas/core/indexes/datetimes.py 96.14% <0%> (-0.18%) ⬇️
pandas/core/nanops.py 94.9% <0%> (-0.16%) ⬇️
pandas/core/indexes/datetimelike.py 97.59% <0%> (-0.11%) ⬇️
pandas/util/testing.py 87.75% <0%> (-0.1%) ⬇️
pandas/core/arrays/period.py 98.39% <0%> (-0.09%) ⬇️
pandas/core/indexes/period.py 92.69% <0%> (-0.07%) ⬇️
pandas/core/generic.py 96.62% <0%> (-0.01%) ⬇️
pandas/core/internals/blocks.py 93.81% <0%> (-0.01%) ⬇️
... and 24 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update aa1549f...4406988. Read the comment docs.

@datapythonista
Copy link
Member Author

@TomAugspurger if you have time and can take a look at this. Besides simplifying the code to build the docs, this will allow to build a single page much faster. That will be useful for fixing the warnings, and I'd like to time the build of each page, and see if we can reduce the time of the slowest examples.

Copy link
Contributor

@TomAugspurger TomAugspurger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a couple small comments / questions. LGTM though.

doc/make.py Outdated
pass
return single_doc[len('pandas.'):]
else:
raise ValueError('--single value should be a valid path to a '
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you print out single_doc here, so the user sees what they passed?

@@ -326,7 +214,7 @@ def main():
help='command to run: {}'.format(', '.join(cmds)))
argparser.add_argument('--num-jobs',
type=int,
default=1,
default=0,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the DocBuilder init, the default is 1. Make them both the same?

What does a value of 0 do?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. with 0 I don't pass a -j value to sphinx-build, while with 1, I pass -j 1, which is actually the same (unless sphinx changes its default).

It's a bit weird, because the -j parameter is supposed to make sphinx-build run with multiple cores, but it actually doesn't work, and the process takes exactly the same with -j 1 and -j 4. It could make sense to remove this option, but I guess at some point sphinx will be fixed at some point, so I guess it's worth leaving it.

I'm happy setting our default to 0 (use sphinx default), 1, or auto, just let me know if you have a preference.

I address your other comment.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm I think multiple cores speeds things up for me, at least for a full doc build.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked it with time in Linux, 1 vs 4 cores, it took 17m30s in both cases (with a difference of less than 5 seconds between them). I tried it in the past with a different computer (also Linux) and was the same.

@datapythonista datapythonista merged commit d5e5bf7 into pandas-dev:master Dec 30, 2018
thoo added a commit to thoo/pandas that referenced this pull request Dec 30, 2018
* upstream/master:
  DOC: Fixing broken references in the docs (pandas-dev#24497)
  DOC: Splitting api.rst in several files (pandas-dev#24462)
  Fix misdescription in escapechar (pandas-dev#24490)
  Floor and ceil methods during pandas.eval which are provided by numexpr (pandas-dev#24355)
  BUG: Pandas any() returning false with true values present (GH pandas-dev#23070) (pandas-dev#24434)
  Misc separable pieces of pandas-dev#24024 (pandas-dev#24488)
  use capsys.readouterr() as named tuple (pandas-dev#24489)
  REF/TST: replace capture_stderr with pytest capsys fixture (pandas-dev#24496)
  TST- Fixing issue with test_parquet test unexpectedly passing (pandas-dev#24480)
  DOC: Doc build for a single doc made much faster, and clean up (pandas-dev#24428)
  BUG: Fix+test timezone-preservation in DTA.repeat (pandas-dev#24483)
  Implement reductions from pandas-dev#24024 (pandas-dev#24484)
thoo added a commit to thoo/pandas that referenced this pull request Dec 30, 2018
…strings

* upstream/master:
  TST: Skip db tests unless explicitly specified in -m pattern (pandas-dev#24492)
  Mix EA into DTA/TDA; part of 24024 (pandas-dev#24502)
  DOC: Fix building of a single API document (pandas-dev#24506)
  DOC: Fixing broken references in the docs (pandas-dev#24497)
  DOC: Splitting api.rst in several files (pandas-dev#24462)
  Fix misdescription in escapechar (pandas-dev#24490)
  Floor and ceil methods during pandas.eval which are provided by numexpr (pandas-dev#24355)
  BUG: Pandas any() returning false with true values present (GH pandas-dev#23070) (pandas-dev#24434)
  Misc separable pieces of pandas-dev#24024 (pandas-dev#24488)
  use capsys.readouterr() as named tuple (pandas-dev#24489)
  REF/TST: replace capture_stderr with pytest capsys fixture (pandas-dev#24496)
  TST- Fixing issue with test_parquet test unexpectedly passing (pandas-dev#24480)
  DOC: Doc build for a single doc made much faster, and clean up (pandas-dev#24428)
  BUG: Fix+test timezone-preservation in DTA.repeat (pandas-dev#24483)
  Implement reductions from pandas-dev#24024 (pandas-dev#24484)
Pingviinituutti pushed a commit to Pingviinituutti/pandas that referenced this pull request Feb 28, 2019
Pingviinituutti pushed a commit to Pingviinituutti/pandas that referenced this pull request Feb 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants