Install documentation dependencies:
pip install -r docs/requirements.txtThe requirements include:
- sphinx
- sphinx_rtd_theme
- numpy
- opencv-python
- Pillow
From the root directory of the project, run:
sphinx-build -b html docs docs/_build/htmlThis will:
- Generate HTML documentation from docstrings
- Create API reference automatically
- Output files to docs/_build/html directory
For live preview while writing documentation:
sphinx-autobuild docs docs/_build/htmlThis will:
- Start a local server (usually at http://127.0.0.1:8000)
- Auto-rebuild when files change
- Auto-reload the browser
Use NumPy style docstrings for all Python functions:
def function_name(param1: type, param2: type) -> return_type:
"""Short description of function.
Detailed description of function behavior.
Parameters
----------
param1 : type
Description of first parameter
param2 : type
Description of second parameter
Returns
-------
return_type
Description of return value
Examples
--------
>>> result = function_name(1, 2)
>>> print(result)
3
"""docs/
├── conf.py # Sphinx configuration
├── index.rst # Main documentation page
├── requirements.txt # Documentation dependencies
├── _build/ # Generated documentation
└── _static/ # Static files (images, etc)
The documentation automatically builds on Read the Docs when you push to the main branch. Configuration is in .readthedocs.yaml at the root of the project.
If builds fail:
- Check the build logs on Read the Docs
- Verify all dependencies are in docs/requirements.txt
- Test locally with:
sphinx-build -b html docs docs/_build/html -a -E
- Clear build directory and rebuild:
rm -rf docs/_build sphinx-build -b html docs docs/_build/html