Install the following packages.
sphinx==7.2.6
sphinx_rtd_theme==2.0.0
Run the following command in the terminal to create a documentation on all modules and packages contained in your project.
sphinx-apidoc -d 5 -e -M -a -F -f -H <Project name> -A <Author name> -V <Version number> -o docs . <Exclusion patterns (optional)>
⚠️ Warning
Before running this command, make sure that each of your packages has a__init__.py
file.
Here is an example:
sphinx-apidoc -d 5 -e -M -a -F -f -H Bond -A Paul_Creusy -V 1.0.0 -o docs . draft*
Go to the file docs/conf.py
and:
- add
sphinx_rtd_theme
to theextensions_list
variable - change
html_theme
tosphinx_rtd_theme
If you are using Numpy or Google docstring style, you will need to add the extension sphinx.ext.napoleon
to the list in the docs/conf.py
file.
Run the following commands:
cd docs
make html
Open the file docs/_build/index.html
in your web browser.