arborist/docs/_source
russell@unturf.com 49607a5997
docs: add Sphinx API reference generation from docstrings
Implements Read the Docs infrastructure to generate API documentation
directly from code docstrings. Replaces static modules.md (1200+ lines).

New structure:
- docs/_source/conf.py — Sphinx configuration (furo theme)
- docs/_source/index.rst — Main TOC
- docs/_source/api/*.rst — Module groups (substrate, storage, retrieval,
  qa, distill, mesh, cli)
- docs/_source/Makefile — Local build targets
- docs/_source/README.md — Documentation on building and extending

Makefile integration:
- make docs-api — generate HTML (output: docs/_source/_build/html/)
- make docs-api-clean — remove build artifacts

Build output (40 HTML files):
- API module reference with docstrings
- Source code links (:viewcode: extension)
- Full-text search index
- Module index (genindex, py-modindex)

Sphinx installed in venv as dev dependency. HTML is browseable at
docs/_source/_build/html/index.html (open in browser after build).

This justifies the deletion of modules.md: code docstrings + Sphinx
autodoc = automatically-generated, always-current API reference.
2026-05-04 07:55:34 -04:00
..
_build/html docs: add Sphinx API reference generation from docstrings 2026-05-04 07:55:34 -04:00
api docs: add Sphinx API reference generation from docstrings 2026-05-04 07:55:34 -04:00
conf.py docs: add Sphinx API reference generation from docstrings 2026-05-04 07:55:34 -04:00
index.rst docs: add Sphinx API reference generation from docstrings 2026-05-04 07:55:34 -04:00
Makefile docs: add Sphinx API reference generation from docstrings 2026-05-04 07:55:34 -04:00
README.md docs: add Sphinx API reference generation from docstrings 2026-05-04 07:55:34 -04:00

Aborist API Reference (Sphinx)

This directory contains Sphinx configuration to generate API documentation from docstrings.

Build

cd docs/_source
make html           # Generate HTML (output: _build/html/)
make text           # Generate text (output: _build/text/)
make clean          # Remove build artifacts

Or directly:

sphinx-build -b html . _build/html

View

After building, open _build/html/index.html in a browser.

Structure

  • conf.py — Sphinx configuration
  • index.rst — Main table of contents
  • api/ — Module documentation (one .rst per module category)
    • substrate.rst — Core data structures (merkle, document, wikitext)
    • storage.rst — SQLite schema (store, ingest, evict)
    • retrieval.rst — FTS5 search (search, sources, concepts)
    • qa.rst — Q&A pipeline (runner, query, verify, evidence, etc.)
    • distill.rst — Distillation (surface→core)
    • mesh.rst — Federation (gossip-based sync)
    • cli.rst — Command-line interface

What it replaces

This generated documentation replaces docs/modules.md (1200+ lines of static API reference). The docstrings in code are the source of truth; Sphinx extracts them automatically.

Adding new modules

  1. Add a docstring to the module (module-level docstring at the top of module.py)
  2. Add an .rst file in api/ that includes the module with automodule directive
  3. Reference it in index.rst
  4. Rebuild with make html

Theme

Uses furo theme (modern, responsive, search-enabled).

Autodoc directives

The .rst files use Sphinx automodule to extract:

  • Module docstrings
  • Class docstrings + members
  • Function signatures + docstrings
  • Source code links (:viewcode: extension)

See Sphinx autodoc docs.