-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Allow pip install --no-deps
to meet the dependencies for Sphinx autodoc
#5512
Comments
I don't think we are going to add more options for pip, sorry. One solution that comes to my mind is make use of the |
And if you need some dependencies, you can just create a custom requirements file only for your docs. |
@stsewd Thanks for the suggestion! I tweaked
Feels a bit hacky but does solve the problem. Thanks again. |
readthedocs/readthedocs.org#5512 (comment) Signed-off-by: Lizzie Lundgren <elundgren@seas.harvard.edu>
These changes reflect the same approach as outlined in this issue: readthedocs/readthedocs.org#5512
Details
Problem
I am using Sphinx-autodoc to generate API docs for my Python package.
Originally I used Conda to install the full dependencies on readthedocs, but it took too long to build and sometimes even failed (#4695). So, I switched to pure
pip
(JiaweiZhuang/xESMF@53816d3), which accelerated the build a lot. However, since that switch, Sphinx-autodoc failed to generate API docs. My API page is almost blank:This is because my package itself has heavy dependencies that cannot be installed by
pip
. Some C/Fortran extensions must be installed byconda
. So, autodoc cannot import my package:Methods I have tried
I am able to generate correct API docs with pip locally, using two hacks:
pip install --no-deps xesmf
.autodoc_mock_imports = ['numpy', 'xarray', 'scipy', 'ESMF']
inconf.py
. Among them, ESMF is an extremely heavy dependency that can only be installed by Conda (and takes a long time to install).Even with
autodoc_mock_imports
, I still have to pip-install my packagexesmf
to provide the docstring for sphinx-autodoc. I have read the Read the Docs Configuration File but cannot find a way to specify the--no-deps
option or add custom pip commands.Right now, I can only think of two highly-unsatisfying solutions to build the API docs correctly online:
setup.py
, so I can pip-install it without the--no-deps
option. This is not good for my package itself.So I am still looking for a better solution. Any suggestions would be appreciated!
Extra information
Here are the full steps to build the correct doc on my laptop:
The correct API page would look like:
The text was updated successfully, but these errors were encountered: