This folder contains the Sphinx documentation source and build tooling for local development and GitHub Pages publishing.
- Prerequisites
- Make Targets
- Multiversion Implementation (No sphinx-multiversion)
- Purge and Rebuild Behavior
- Local Build and Testing
- GitHub Pages Deployment
- Notes and Troubleshooting
- Python environment with docs dependencies installed:
pip install --require-hashes --no-deps -r requirements-docs.lock- or (less strict)
pip install -r requirements-docs.txt
- Install the Enchant C library (required by
sphinxcontrib-spelling):- macOS (Homebrew):
brew install enchant - Windows (Chocolatey):
choco install enchant
- macOS (Homebrew):
- Run commands from the repo root with
make -C docs ..., or from this folder withmake ....
The docs/Makefile supports these explicit targets:
make help- Shows Sphinx make-mode help and all supported builder targets.
make html- Standard single-version HTML build into
docs/build/html.
- Standard single-version HTML build into
make spelling- Runs the spelling builder and fails if any misspelled words are found (
scripts/ci/docs_spelling_check.sh).
- Runs the spelling builder and fails if any misspelled words are found (
make md- Builds Markdown output to
docs/build/markdownand copies images/static assets.
- Builds Markdown output to
make html-multiversion- Builds versioned docs without
sphinx-multiversionusingscripts/build_versioned_docs.sh.
- Builds versioned docs without
make html-multiversion-preview- Same as above, plus the current git branch as
local-branch-preview.
- Same as above, plus the current git branch as
Catch-all behavior is enabled:
- Any unknown target is forwarded to
sphinx-build -M. - Example:
make clean,make linkcheck,make dirhtml.
Versioned docs are generated by:
docs/scripts/build_versioned_docs.sh(entrypoint)docs/scripts/build_versioned_docs.py(orchestrator)docs/scripts/select_versions.py(version selection rules)
mainbranch is always built and published ascurrent.- Selected release tags are built from git tags.
- Docs IA cutover at v0.21.0:
currentand tags>= v0.21.0use main'sdocs/conf.pywith that ref'sdocs/source(sphinx-immaterial / section-folder IA).- Tags
<= v0.20.xusev0.20.0'sdocs/conf.py(RTD / flat layout) with each tag's owndocs/source.
local-branch-preview(optional) uses the current branch's own conf + source (pre-merge validation).- Output layout:
docs/build/html/current/index.htmldocs/build/html/vX.Y.Z/index.htmldocs/build/html/versions.jsondocs/build/html/index.html(redirects tocurrent/index.html)
scripts/select_versions.py applies these rules:
- Identify the highest major version present in tags.
- For major
0, include the latest patch release for every minor from the current minor down to0.12(inclusive). - For other majors, include the latest patch release for the last 5 minor series in that major.
- Include the latest available release for each of the last 3 majors.
- De-duplicate and sort descending (newest first).
Example ordering:
currentv0.16.0v0.15.5v0.14.0v0.13.0v0.12.1- … through
v0.12.xwhen older minors exist
scripts/build_versioned_docs.pywrites a supersetversions.jsonwith:- mike / sphinx-immaterial fields:
version,title,aliases - legacy RTD fields:
name,display_version,url,status,is_latest,release_date
- mike / sphinx-immaterial fields:
- RTD-era refs load the manifest at build time via
DOCS_VERSIONS_FILEintoversions.html. - Immaterial refs enable
version_dropdownand fetch the parent../versions.jsonover HTTP (version_jsoninconf.py). - Use a local HTTP server to test the immaterial switcher (see below).
make -C docs html-multiversion-preview- Still publishes
currentfrommain. - Also builds the current git branch once as
local-branch-preview(skipped if you are onmainor detached HEAD). - To review a feature branch before merge, check it out, run preview, then select
local-branch-previewin the version menu. - Preview builds from the working tree (uncommitted conf/theme/source edits are included).
Each versioned build is clean:
docs/build/htmlis removed before rebuilding.- Temporary git worktrees under
docs/build/.worktreesare removed after build. git worktree pruneruns at the end.
This ensures old/stale version folders are purged from the publish artifact.
Use this command order during docs development:
- Quick content/format validation while iterating:
make -C docs html- Always run spelling before finalizing:
make -C docs spelling- If your change could affect versioned output or version switcher behavior:
make -C docs html-multiversion- If you need to preview the current branch against
main/ release tags:
make -C docs html-multiversion-previewPractical rule of thumb:
- Doc text/layout change only:
html+spelling - Versioning/switcher/build-script change:
html+spelling+html-multiversion - Branch theme/IA preview:
html-multiversion-preview, then selectlocal-branch-preview
- Direct file open:
docs/build/html/index.html
- Recommended local server (more browser-consistent):
cd docs/build/html
python3 -m http.server 8000Then open http://localhost:8000/current/index.html to exercise the version dropdown.
Note: make html builds a single-version tree without a parent-level versions.json; use html-multiversion to test version switching.
The workflow is in .github/workflows/main-docs.yml.
On push to main or release tags:
- Checkout full history and tags.
- Install docs dependencies.
- Run
bash docs/scripts/build_versioned_docs.sh. - Upload
docs/build/htmlas Pages artifact. - Deploy with GitHub Pages actions.
The deployed root redirects to current/index.html.
Build output also includes:
sitemap.xmlfor search-engine discovery.robots.txtreferencing the sitemap.- Canonical URL metadata on pages, based on
html_baseurlindocs/conf.py.
- If version links look wrong, inspect
docs/build/html/versions.json. - If tags seem missing, verify local git tags are fetched:
git fetch --tags
- If local browser shows folder listing, use the explicit
index.htmlURLs or run a local HTTP server.