-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
[MRG] MAINT moving to modern way of building docs. #9402
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
Conversation
A recent sphinx will generate a much simpler makefile
I would suggest sticking to it (basically sphinx already provides all the necessary machinery), and changing the CI build to use
(disallow warnings -- when building locally I'd much rather have the build go to the end and give me all warnings)
(which can be combined more easily with -W) and add the secondary targets manually to the makefile. But in general I agree with the idea. |
@@ -34,9 +34,9 @@ generated. | |||
|
|||
You can build the documentation with several options: |
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.
options -> targets
I think this is a great idea...not really any specific complaint from me so long as the docs build fine on the tests/CI. I'm 50/50 on including both a Makefile and a |
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.
Approve pending tests/CI pass
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.
Feel free to dismiss this if you really don't want to switch to the shorter, newer makefile (but why?).
DEPSY_DEFAULT = "_static/depsy_badge_default.svg" | ||
|
||
|
||
def fetch_depsy_badge(): |
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.
Can this be ported over as well? This works around depsy not having an https end point which results in matplotlib.org warning about non-secure resources.
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.
I am also ok with just removing the depsy badge, it seems to not have been updated recently.
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.
I'll deal with that once I figure out the examples not running issue.
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.
I'm in favor of removing all the badges that we have. We have a problem of signal to noise ratio on the website, so we need to think about what is necessary and what can be remove, and I think this can safely been remove (basically, those badges are only understood by people who already know this information).
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.
👍 in principle, but I think the depsy badge handling needs to be ported.
DEPSY_DEFAULT = "_static/depsy_badge_default.svg" | ||
|
||
|
||
def fetch_depsy_badge(): |
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.
I am also ok with just removing the depsy badge, it seems to not have been updated recently.
* `-n N` enables parallel build of the documentation using N process. | ||
* `make html-noplot` doesn't save the gallery's images. Allows for fast build. | ||
* `make html-allow-warnings`: Don't turn Sphinx warnings into errors. | ||
* `make -j N` enables parallel build of the documentation using N process. |
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.
Sorry if this a silly question, but what in the makefile deals with this? It still seems to only use one processor when running locally....
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.
I'd guess the correct invocation is make SPHINXOPTS=-j$N ...
|
||
# Change directory to the one containing this file | ||
current_dir = os.getcwd() | ||
os.chdir(os.path.dirname(os.path.join(current_dir, __file__))) |
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.
I suspect that this line is the source of the import failures.
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.
The old make.py compiles fine without those lines, so I don't think that this is the problem.
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.
I've opened a PR on sphinx-gallery that "fixes" the problem. I have no clue how the old make.py managed to build the examples considering the sphinx-gallery code I patched.
I would not be surprised that my patch gets rejected, as it opens the door to examples that are not self contained (which is our problem). I think the correct solution would be to make the units examples self-contained and easier to understand.
I am also getting local failures WARNING: /home/tcaswell/source/p/matplotlib/examples/units/radian_demo.py failed to execute correctly: Traceback (most recent call last):
File "/home/tcaswell/source/p/matplotlib/examples/units/radian_demo.py", line 17, in <module>
from basic_units import radians, degrees, cos
ModuleNotFoundError: No module named 'basic_units'
WARNING: /home/tcaswell/source/p/matplotlib/examples/units/units_sample.py failed to execute correctly: Traceback (most recent call last):
File "/home/tcaswell/source/p/matplotlib/examples/units/units_sample.py", line 16, in <module>
from basic_units import cm, inch
ModuleNotFoundError: No module named 'basic_units'
WARNING: /home/tcaswell/source/p/matplotlib/examples/units/units_scatter.py failed to execute correctly: Traceback (most recent call last):
File "/home/tcaswell/source/p/matplotlib/examples/units/units_scatter.py", line 15, in <module>
from basic_units import secs, hertz, minutes
ModuleNotFoundError: No module named 'basic_units'
WARNING: /home/tcaswell/source/p/matplotlib/examples/units/bar_demo2.py failed to execute correctly: Traceback (most recent call last):
File "/home/tcaswell/source/p/matplotlib/examples/units/bar_demo2.py", line 17, in <module>
from basic_units import cm, inch
ModuleNotFoundError: No module named 'basic_units'
WARNING: /home/tcaswell/source/p/matplotlib/examples/units/annotate_with_units.py failed to execute correctly: Traceback (most recent call last):
File "/home/tcaswell/source/p/matplotlib/examples/units/annotate_with_units.py", line 15, in <module>
from basic_units import cm
ModuleNotFoundError: No module named 'basic_units'
WARNING: /home/tcaswell/source/p/matplotlib/examples/units/bar_unit_demo.py failed to execute correctly: Traceback (most recent call last):
File "/home/tcaswell/source/p/matplotlib/examples/units/bar_unit_demo.py", line 15, in <module>
from basic_units import cm, inch
ModuleNotFoundError: No module named 'basic_units'
WARNING: /home/tcaswell/source/p/matplotlib/examples/units/artist_tests.py failed to execute correctly: Traceback (most recent call last):
File "/home/tcaswell/source/p/matplotlib/examples/units/artist_tests.py", line 23, in <module>
from basic_units import cm, inch
ModuleNotFoundError: No module named 'basic_units'
WARNING: /home/tcaswell/source/p/matplotlib/examples/units/ellipse_with_units.py failed to execute correctly: Traceback (most recent call last):
File "/home/tcaswell/source/p/matplotlib/examples/units/ellipse_with_units.py", line 12, in <module>
from basic_units import cm
ModuleNotFoundError: No module named 'basic_units'
generating gallery for gallery/units... [100%] basic_uni |
@tacaswell I'm not getting local failures. Which version of sphinx & sphinx-gallery are you using? Are you using some form of virtual environments (conda, virtualenv)? |
This is venv
I think this is the same issue that we are seeing on circle. |
@tacaswell Yes. I'm reproducing the errors locally. Thanks |
- Switching to Makefile to build the documentation like the rest of the Python ecosystem. - Related to MEP10 closes #5798
In addition, sphinx 1.6.4 is buggy
This PR is ready to be reviewed. |
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.
Left a few questions. Still a bit unclear how -j 4
would make it in for parallel builds.
colorspacious | ||
ipython | ||
mock | ||
numpydoc | ||
pillow | ||
sphinx-gallery>=0.1.12 | ||
sphinx-gallery |
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.
Why drop the pinning on this?
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.
That was a mistake… putting it back.
@@ -28,6 +28,35 @@ apt-run: &apt-install | |||
libgeos-dev \ | |||
otf-freefont | |||
|
|||
conda36-run: &conda36-install |
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.
Why switch to conda? It looks like all we are using is python and then pip installing everything else.
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.
I switch to conda only for the environment: we now need to access the scripts "sphinx-build", and not only the library as before. When installing with --user, we either need to change the PYTHONPATH manually, or use conda.
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.
Why not just use python -msphinx
instead? AFAIK sphinx-build is a strict synonym to it, except that python -msphinx
looks up PYTHONPATH (which is the same as what we did before in make.py) whereas sphinx-build uses PATH (which may be set differently).
This relates to my earlier point about using the shorter/newer makefile generated by recent versions of sphinx.
command: | | ||
export PATH="$HOME/miniconda/bin:$PATH" | ||
source activate testenv | ||
pip install -ve . |
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.
do the docs build with a non-editable installation?
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.
They should. I can switch to pip install -v .
if you prefer.
@tacaswell I'm not sure what you mean by the parallel build.
|
@tacaswell never mind… I just understood your question. |
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.
Duplicate templating should be removed.
conda create -n testenv --yes --quiet python | ||
source activate testenv | ||
|
||
conda27-run: &conda27-install |
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.
All of these are templated so you don't need to write out two copies for Python 3 and 2. There should not be a separate 36 and 27 template. You can use an environment variable to differentiate if necessary (see the NUMPY
variable for example).
is there a reason this was closed? seems like it is getting close! |
I'm not going to have time to fix the current blockers for merge anytime soon. |
ecosystem.
closes #5798
PR Summary
PR Checklist