| name | docs |
|---|---|
| description | Update, review, or build the Sphinx documentation for Democrasite |
| disable-model-invocation | true |
| argument-hint | [what to update or check, e.g. 'review for accuracy' or 'add social section'] |
$ARGUMENTS
docs/
├── conf.py — Sphinx config (theme, extensions, Django setup)
├── index.rst — Master toctree (README, CONTRIBUTING, howto, users, webiscite, api/)
├── README.rst — Project overview (mirrors root README)
├── CONTRIBUTING.rst — Dev setup and contribution guide
├── howto.rst — Instructions for building and writing docs
├── users.rst — Users app overview (minimal; relies on autodoc)
├── webiscite.rst — Core app narrative (pipeline, bill lifecycle)
└── api/ — Auto-generated RST files (do not edit manually)
├── democrasite.rst
├── democrasite.webiscite.rst
├── democrasite.webiscite.models.rst
├── democrasite.webiscite.managers.rst
├── democrasite.webiscite.tasks.rst
├── democrasite.webiscite.webhooks.rst
├── democrasite.webiscite.constitution.rst
├── democrasite.webiscite.views.rst
├── democrasite.webiscite.api.rst
├── democrasite.users.rst
├── democrasite.social.rst
└── … (one file per module)
All run from the docs/ directory (or with make -C docs <target>):
| Command | What it does |
|---|---|
make apidocs |
Regenerate all docs/api/*.rst from source using sphinx-apidoc. Run this whenever Python modules are added or removed. |
make livehtml |
Build docs and serve with live reload at http://localhost:9000. Requires the docs Docker container (docker compose -f docker-compose.docs.yml up). |
make clean |
Remove _build/ and api/ directories for a fresh build. |
make html |
One-off HTML build into _build/html/. |
To serve with live reload locally (in Docker):
docker compose -f docker-compose.docs.yml up
To regenerate API docs locally (sphinx-apidoc must be installed):
make -C docs apidocs
docs/api/— fully auto-generated bymake apidocs(sphinx-apidoc). Never edit these files directly; edit the Python docstrings instead, then re-runmake apidocs.docs/webiscite.rstanddocs/users.rst— manually maintained narrative docs. Keep these in sync with code changes (especiallywebiscite.rstfor the PR pipeline and bill lifecycle).docs/CONTRIBUTING.rstanddocs/howto.rst— manually maintained.
Use Google-style docstrings (supported via the Napoleon extension). Example:
def my_function(arg: int) -> str:
"""One-line summary.
Longer description if needed.
Args:
arg: Description of the argument.
Returns:
Description of the return value.
Raises:
ValueError: When and why.
"""Line length: 88 characters (enforced by ruff). Wrap long docstring lines to stay within this limit.
- Read
docs/webiscite.rstand cross-check function/class references against actual source code - Check that docstrings in
democrasite/webiscite/managers.py,models.py,tasks.py,webhooks.py, andconstitution.pyhave correct parameter names and return descriptions - Run
make apidocsif modules have been added or removed since the last regeneration - Run
just lintto confirm no ruff line-length violations were introduced
- Edit the relevant
.rstfile indocs/(not underdocs/api/) - Use Sphinx cross-references for code identifiers:
:class:\~democrasite.webiscite.models.Bill`` — class link:func:\~democrasite.webiscite.tasks.submit_bill`` — function link:meth:\~democrasite.webiscite.webhooks.PullRequestHandler.opened`` — method link
- Verify the build:
docker compose -f docker-compose.docs.yml up
- Write a module-level docstring at the top of the file
- Run
make apidocsto regeneratedocs/api/— this creates the new RST file and adds it to the relevant package toctree automatically - Commit the updated
docs/api/files alongside the new module
- Update any cross-references in
docs/webiscite.rstordocs/users.rstthat point to renamed/removed identifiers - Update affected docstrings in source files
- Run
make apidocsif the module structure changed (files added/removed) - Run
just lintto verify no line-length violations
- ReadTheDocs URL: https://cookiestocracy.readthedocs.io/en/latest/
- Builds automatically on push to the main branch