Building the NumPy API and reference docs — NumPy v2.3.dev0 Manual (original) (raw)
If you only want to get the documentation, note that pre-built versions can be found at
in several different formats.
Development environments#
Before proceeding further it should be noted that the documentation is built with the make
tool, which is not natively available on Windows. MacOS or Linux users can jump to Prerequisites. It is recommended for Windows users to set up their development environment on GitHub Codespaces (see Recommended development setup) orWindows Subsystem for Linux (WSL). WSL is a good option for a persistent local set-up.
Prerequisites#
Building the NumPy documentation and API reference requires the following:
NumPy#
Since large parts of the main documentation are obtained from NumPy viaimport numpy
and examining the docstrings, you will need to firstbuild and install it so that the correct version is imported. NumPy has to be re-built and re-installed every time you fetch the latest version of the repository, before generating the documentation. This ensures that the NumPy version and the git repository version are in sync.
Note that you can e.g. install NumPy to a temporary location and set the PYTHONPATH environment variable appropriately. Alternatively, if using Python virtual environments (via e.g. conda
,virtualenv
or the venv
module), installing NumPy into a new virtual environment is recommended.
Dependencies#
All of the necessary dependencies for building the NumPy docs except forDoxygen can be installed with:
pip install -r requirements/doc_requirements.txt
Note
It may be necessary to install development versions of the doc dependencies to build the docs locally:
pip install --pre --force-reinstall --extra-index-url
https://pypi.anaconda.org/scientific-python-nightly-wheels/simple
-r requirements/doc_requirements.txt
We currently use Sphinx along with Doxygen for generating the API and reference documentation for NumPy. In addition, building the documentation requires the Sphinx extension plot_directive, which is shipped withMatplotlib. We also use numpydoc to render docstrings in the generated API documentation. SciPyis installed since some parts of the documentation require SciPy functions.
For installing Doxygen, please check the officialdownload andinstallation pages, or if you are using Linux then you can install it through your distribution package manager.
Note
Try to install a newer version of Doxygen > 1.8.10 otherwise you may get some warnings during the build.
Submodules#
If you obtained NumPy via git, also get the git submodules that contain additional parts required for building the documentation:
git submodule update --init
Instructions#
Now you are ready to generate the docs, so write:
This will build NumPy from source if you haven’t already, and run Sphinx to build the html
docs. If all goes well, this will generate a build/html
subdirectory in the /doc
directory, containing the built documentation.
The documentation for NumPy distributed at https://numpy.org/doc in html and pdf format is also built with make dist
. See HOWTO RELEASE for details on how to update https://numpy.org/doc.