Working on the documentation¶
The published site is at https://mustafamm072.github.io/MedAugmentX/. This page is for people changing it.
For a deterministic offline build, set MEDAUGMENTX_DOCS_OFFLINE=1 before
running Sphinx. CI uses this mode; it disables external intersphinx inventory
fetches while retaining local API cross-references.
How the site is put together¶
Sphinx is invoked with the repository root as its source directory:
python -m sphinx -W --keep-going -b html -c docs/sphinx . /tmp/medaugmentx-docs
That is deliberate. README.md, CHANGELOG.md, CONTRIBUTING.md, and
SECURITY.md are rendered where they live instead of being copied into a docs
tree, so there is never a second version of them to keep in sync.
include_patterns in docs/sphinx/conf.py lists exactly
which files are picked up; a Markdown file not matched there is invisible to the
build.
Because the root document therefore lands at docs/sphinx/index.html rather
than at the top of the output, docs/sphinx/_extra/index.html is copied to the
output root as a redirect, and CI asserts that the redirect exists rather than
publishing a site whose front door 404s.
Generated vs. hand-written¶
Anything describing the code is generated, so it cannot drift:
Page |
Source |
|---|---|
|
|
|
|
Per-transform entries |
|
Both directives live in docs/sphinx/_ext/mx_catalog.py.
They derive the summary from the first paragraph of each class docstring, the
parameter list from the constructor signature, and the “Targets” column from
whether the defining module uses medaugmentx.core.geometry — which is the only
way a transform can move keypoints and boxes. Adding a transform to
medaugmentx/transforms/__init__.py is all it takes to appear in the docs.
Everything else is prose written by hand: the guides in this directory, and the
landing page at docs/sphinx/index.rst.
The guides¶
Document |
Covers |
|---|---|
Task-shaped snippets for common workflows |
|
Stability policy and the semantics that span several classes — not signatures, which are generated |
|
Layering, dependency boundaries, transform contracts, testing strategy |
|
Replay, worker seeds, evaluation reporting, citation |
|
Production readiness, intended use, validation, audit trail, privacy |
|
Roadmap and v1.0 acceptance criteria |
Making a change¶
pip install -e ".[docs]"
python -m sphinx -W --keep-going -b html -c docs/sphinx . /tmp/medaugmentx-docs
open /tmp/medaugmentx-docs/index.html
-W turns warnings into errors, matching CI — a broken cross-reference or a
page missing from a toctree fails the build rather than shipping quietly. The
docs extras must be installed in the same environment as the package, since
autodoc imports medaugmentx to read its docstrings.
When adding a page:
Put
.rstunderdocs/sphinx/(already covered byinclude_patterns), or Markdown indocs/.Add it to one of the four
toctreeblocks indocs/sphinx/index.rst— Getting started, Reference, Guides, or Project. Every page must be in one, or-Wwill fail the build.Rebuild and check the sidebar.
Publishing¶
.github/workflows/docs.yml rebuilds and redeploys on every push to main, and
can be run by hand from the Actions tab (Docs → Run workflow). The repository
must keep Settings → Pages → Source: GitHub Actions; if that is switched
off, the build step still passes and only the deploy step fails.
ci.yml builds the same site on every push and pull request with -W and
uploads it as an artifact, so documentation warnings are caught on branches that
never deploy.