Closed samuelmurail closed 5 months ago
Hi @samuelmurail - thanks for the report.
Is it expected to install numpy to build the documentation ?
Generally it is the case that when Sphinx builds Python-based documentation, it reads and evaluates the Python code files within the project.
So in general, it is necessary for your project's Python code to evaluate successfully, including resolution of module imports, etc. As you've found, there are some options to allow mocking-out individual imports in cases where it isn't desirable to have those installed at doc-build-time.
I'm not hugely familiar with cpython
, but my guess is that the cimport
statement is not mocked out by autodoc_mock_imports
-- and that when it is evaluated, it attempts to load some numpy
Python modules that you don't have available, causing the module's evaluation (and then your Sphinx project build) to fail.
I'm not certain that this is a bug, so I'm going to remove the label and relocate this thread into the GitHub discussions area until we confirm either that this is in fact a bug, or perhaps figure out a feature request / enhancement proposal from it.
Describe the bug
Hello everybody,
I am trying to create the automodule section of my library (https://github.com/samuelmurail/pdb_numpy)
But I get this warning, and the automodule docs is not created:
Im my cython library
align_cython.pyx
I have put#cython: embedsignatures=True
andcnp.import_array()
:This error happen when I use
autodoc_mock_imports = ["numpy", "scipy", "pytest"]
If I install
numpy
, and removenumpy
fromautodoc_mock_imports
then the automodule is build.Is it expected to install numpy to build the documentation ? Should I add numpy to sphinx
requirements.txt
?Cheers, Thanks for your help.
How to Reproduce
sphinx-build -M html "source" "build"
Environment Information
Sphinx extensions
Additional context
No response