Documentation#

How to build the documentation locally#

Similarly to testing, there are also tox jobs that take care of building the right environment and running the required commands to build the documentation.

In general the process should follow these three steps in this order:

tox -e cleandocs
tox -e docs # or tox -e nogallerydocs
tox -e viewdocs

These commands will respectively:

  • Delete all intermediate sphinx files that were generated during the build process

  • Run sphinx-build command to parse and render the library documentation

  • Open the documentation homepage on the default browser with python -m webbrowser

The only required step however is the middle one. In general sphinx uses the intermediate files only if it detects it hasn’t been modified, so when iterating quickly it is recommended to skip the clean step in order to achieve faster builds. Moreover, if the documentation page is already open on the browser, there is no need for the viewdocs job because the documentation is always rendered on the same path; refreshing the page from the browser is enough.

The example gallery requires processing the python scripts in order to execute each once per backend in order to generate the png or html+javascript preview. Therefore, it is the most time consuming step of generating the documentation. As very often we’ll work on the part of the docs not related to the example gallery, the command tox -e nogallerydocs will generate the documentation without the example gallery, which allows for much faster iteration when writing documentation. This also means for example the minigallery directive in the docstrings won’t work, and sphinx will output warnings about it when using this option.

About arviz-plots documentation#

Documentation for arviz-plots is written in both rST and MyST (which can be used from jupyter notebooks too) and rendered with Sphinx. Docstrings follow the numpydoc style guide.