Repository navigation
Open
Description
Description
I've been finding that tox -e build_docs will succeed locally but then a PR will fail on readthedocs. It also gives a number of warnings about poorly constrained fits, and a non-fatal error about the absence of dask.
Expected behavior
We should make sure the setup is such that readthedocs and build_docs do the same thing, and no unnecessary warnings are raised. It may still make sense to have a not-so-strict version (say, tox -e docs) as well.
How to Reproduce
tox -e build_docs
WARNING: The fit may be unsuccessful; check: meInfoBase .. api/astropy.units.DecibelUnit
The maximum number of function evaluations is exceeded. [astropy.modeling.fitting]
reading sources... [100%] wcs/reference_api .. whatsnew/index
/home/mhvk/data/mhvk/packages/astropy/docs/modeling/parallel-fitting.rst:169: WARNING: Exception occurred in plotting parallel-fitting-10
from /home/mhvk/data/mhvk/packages/astropy/docs/modeling/parallel-fitting.rst:
Traceback (most recent call last):
File "/home/mhvk/data/mhvk/packages/astropy/.tox/build_docs/lib/python3.12/site-packages/astropy/modeling/_fitting_parallel.py", line 338, in parallel_fit_dask
import dask
ModuleNotFoundError: No module named 'dask'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/mhvk/data/mhvk/packages/astropy/.tox/build_docs/lib/python3.12/site-packages/matplotlib/sphinxext/plot_directive.py", line 552, in _run_code
exec(code, ns)
File "<string>", line 2, in <module>
File "/home/mhvk/data/mhvk/packages/astropy/.tox/build_docs/lib/python3.12/site-packages/astropy/modeling/_fitting_parallel.py", line 341, in parallel_fit_dask
raise ImportError("dask is required for this function")
ImportError: dask is required for this function [docutils]
/home/mhvk/data/mhvk/packages/astropy/docs/modeling/parallel-fitting.rst:207: WARNING: Exception occurred in plotting parallel-fitting-11
from /home/mhvk/data/mhvk/packages/astropy/docs/modeling/parallel-fitting.rst:
Traceback (most recent call last):
File "/home/mhvk/data/mhvk/packages/astropy/.tox/build_docs/lib/python3.12/site-packages/matplotlib/sphinxext/plot_directive.py", line 552, in _run_code
exec(code, ns)
File "<string>", line 4, in <module>
NameError: name 'model_fit' is not defined [docutils]
/home/mhvk/data/mhvk/packages/astropy/docs/modeling/parallel-fitting.rst:227: WARNING: Exception occurred in plotting parallel-fitting-12
from /home/mhvk/data/mhvk/packages/astropy/docs/modeling/parallel-fitting.rst:
Traceback (most recent call last):
looking for now-outdated files... none found
File "/home/mhvk/data/mhvk/packages/astropy/.tox/build_docs/lib/python3.12/site-packages/matplotlib/sphinxext/plot_directive.py", line 552, in _run_code
exec(code, ns)
File "<string>", line 1, in <module>
NameError: name 'model_fit' is not defined [docutils]
/home/mhvk/data/mhvk/packages/astropy/docs/modeling/parallel-fitting.rst:239: WARNING: Exception occurred in plotting parallel-fitting-13
from /home/mhvk/data/mhvk/packages/astropy/docs/modeling/parallel-fitting.rst:
Traceback (most recent call last):
File "/home/mhvk/data/mhvk/packages/astropy/.tox/build_docs/lib/python3.12/site-packages/astropy/modeling/_fitting_parallel.py", line 338, in parallel_fit_dask
import dask
ModuleNotFoundError: No module named 'dask'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/mhvk/data/mhvk/packages/astropy/.tox/build_docs/lib/python3.12/site-packages/matplotlib/sphinxext/plot_directive.py", line 552, in _run_code
exec(code, ns)
File "<string>", line 2, in <module>
File "/home/mhvk/data/mhvk/packages/astropy/.tox/build_docs/lib/python3.12/site-packages/astropy/modeling/_fitting_parallel.py", line 341, in parallel_fit_dask
raise ImportError("dask is required for this function")
ImportError: dask is required for this function [docutils]
/home/mhvk/data/mhvk/packages/astropy/docs/modeling/parallel-fitting.rst:255: WARNING: Exception occurred in plotting parallel-fitting-14
from /home/mhvk/data/mhvk/packages/astropy/docs/modeling/parallel-fitting.rst:
Traceback (most recent call last):
File "/home/mhvk/data/mhvk/packages/astropy/.tox/build_docs/lib/python3.12/site-packages/matplotlib/sphinxext/plot_directive.py", line 552, in _run_code
exec(code, ns)
File "<string>", line 4, in <module>
NameError: name 'model_fit' is not defined [docutils]
Versions
import astropy
try:
astropy.system_info()
except AttributeError:
import platform; print(platform.platform())
import sys; print("Python", sys.version)
import astropy; print("astropy", astropy.__version__)
import numpy; print("Numpy", numpy.__version__)
import erfa; print("pyerfa", erfa.__version__)
try:
import scipy
print("Scipy", scipy.__version__)
except ImportError:
print("Scipy not installed")
try:
import matplotlib
print("Matplotlib", matplotlib.__version__)
except ImportError:
print("Matplotlib not installed")# Paste the result here
Reacted by Clément Robert
Activity
neutrinoceros commentedon Sep 22, 2024
I'm seeing all of the same errors and warnings. Additionally, I'm having another issue with parallel builds that just crash
Example traceback
which I'm able to work around with the following patch
Coincidentally, I think I can make all the warnings and errors we're both seeing with this patch
pllim commentedon Sep 23, 2024
I would argue that tox isn't necessary at all to build docs with. Not that hard to type
cd docs; make html(or the Windows variant). That is what RTD is doing anyway. If I can have it my way, I would remove build_docs from tox entirely but I tried it once a long time ago and encountered resistance.mhvk commentedon Sep 23, 2024
I think it is similar with testing,
toxdoesn't really add much except setting up the right virtual environment. But this is quite useful!neutrinoceros commentedon Sep 24, 2024
Agreed with Marten. In my own experience, I very often need to (re)create fresh virtual environments to run astropy's test suite in controled conditions, and it's nice that
toxis there to do the heavy lifting in many common cases. Building docs is a task that requires many additional dependencies that do not belong in a minimal test env, so it seems to fit tox's mission pretty well and I would prefer havingtox -e build_docswork (and be tested) than removing it. Futhermore it seems we can get the "tested" part essentially for free if we tweak RTD to actually exercise it. I don't see clear downsides to this.pllim commentedon Sep 24, 2024
I guess an experimental PR never hurts (except the wallet a little bit).