Improve doc build performance #44
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The documentation build has been taking hours on GitHub while it was taking minutes on my local machine. The issue was traced back to the version of Python. Building the doc using Python 3.8 (which is what I had locally) is fast. Building it with Python 3.9 or 3.10 is very slow. This was verified by running the doc build on GitHub using these different versions:
After further investigation, the issue was traced to the numpydoc docstring validation:
The
numpydoc_validation_checksoption in the Sphinx configuration is what causes the slowdown. The call toinspect.getsourcelinesat https://github.com/numpy/numpydoc/blob/main/numpydoc/validate.py#L213 gets much slower starting with Python >= 3.9, and is what is causing the bad doc build performance.So, in order to have decent performance during CI, as a workaround, we decided to turn off the numpydoc validation for the time being. A separate issue (#47) has been created to revisit this in the future when we are ready to dig into the numpydoc warnings.
Note that this change also turns on the parallel option for Sphinx, as this helps independently with performance a little bit too.