Sphinx API Documentation Setup
Sphinx API Documentation Setup
Status: Skeleton created, awaiting dependency installation
What’s Been Done
✅ Created docs/api/ directory structure
✅ Created conf.py with autodoc configuration
✅ Created index.rst with module structure
What Needs to Be Done (After Other Agent Finishes)
1. Install Sphinx Dependencies
Add to pyproject.toml under [dependency-groups]:
[dependency-groups]
dev = [
"pytest>=8.0",
"Pillow>=10.0",
"sphinx>=7.0",
"sphinx-rtd-theme>=2.0",
"sphinx-autodoc-typehints>=1.25",
]
Then install:
uv sync --dev
2. Generate Module Stubs
cd docs/api
uv run sphinx-apidoc -o . ../../justdoit --separate --force
This creates individual .rst files for each module.
3. Create _static and _templates Directories
mkdir docs/api/_static
mkdir docs/api/_templates
4. Build Documentation
cd docs/api
uv run sphinx-build -b html . _build/html
5. Preview
start _build/html/index.html
6. Update .gitignore
Add:
# Sphinx build output
docs/api/_build/
docs/api/_autosummary/
7. Update CONTRIBUTING.md
Add section under Documentation:
### Building API Documentation
**Build HTML docs:**
```bash
cd docs/api
uv run sphinx-build -b html . _build/html
Preview:
start _build/html/index.html # Windows
Rebuild after changes:
rm -rf _build && uv run sphinx-build -b html . _build/html
## File Structure (When Complete)
docs/api/ ├── conf.py ✅ Created ├── index.rst ✅ Created ├── README.md ✅ This file ├── _static/ ⏳ Create manually or let Sphinx generate ├── _templates/ ⏳ Create manually or let Sphinx generate ├── _build/ ⏳ Generated by sphinx-build (gitignored) │ └── html/ │ └── index.html ├── modules.rst ⏳ Generated by sphinx-apidoc ├── justdoit.rst ⏳ Generated by sphinx-apidoc ├── justdoit.cli.rst ⏳ Generated by sphinx-apidoc ├── justdoit.core.rst ⏳ Generated by sphinx-apidoc └── …
## Configuration Highlights
- **Theme:** Read the Docs (sphinx_rtd_theme)
- **Extensions:** autodoc, napoleon, viewcode, intersphinx, autodoc-typehints
- **Mock imports:** PIL, numpy, sounddevice (prevents import errors)
- **Autodoc:** Shows members, undoc-members, special __init__, inheritance
## Quick Start (When Ready)
```bash
# 1. Install dependencies
uv sync --dev
# 2. Generate module stubs
cd docs/api && uv run sphinx-apidoc -o . ../../justdoit --separate --force
# 3. Build docs
uv run sphinx-build -b html . _build/html
# 4. Open in browser
start _build/html/index.html
Troubleshooting
Import errors during build:
- Check
autodoc_mock_importsinconf.pyincludes optional dependencies
Module not found:
- Verify
sys.path.insert(0, os.path.abspath('../..'))inconf.py
Missing theme:
- Ensure
sphinx-rtd-themeis installed:uv add --dev sphinx-rtd-theme