4.4 KiB
Python docs
A high-level overview of writing and previewing the Rerun Python documentation.
How docs coverage works
The set of symbols documented at ref.rerun.io/docs/python/ is derived
automatically from the public-API conventions in the SDK source. There is no
hand-curated index to maintain in lockstep — adding a new public symbol via
the conventions below is sufficient to surface it in the docs.
A symbol is considered public (and gets documented) when any of the following applies in its module:
- It is listed in the module's
__all__. - It is re-exported via
from ._x import Foo as Foo(PEP 484 redundant alias). - It is defined in-file with a non-underscore name and the module does not
define
__all__.
The conventions are detected by griffe
plus the griffe-public-redundant-aliases
extension (configured in mkdocs.yml).
Adding a new public symbol
- Re-export from a subpackage: add
from ._impl import Foo as Footo the relevant__init__.py. The redundantas Fooform matters — it is also required by pyright's strict-modereportPrivateUsagerule. - Define in-file in a single-file module: include
"Foo"in the module's__all__(e.g., seererun_sdk/rerun/urdf.py,rerun_sdk/rerun/server.py). - Stand up a Track A page for a brand-new subpackage: add a row to
DOCUMENTED_PACKAGESindocs/gen_common_index.pymapping the dotted path to its nav title (e.g.,"rerun.foo": ("Foo",)for a top-level entry, or"rerun.bar.baz": ("Bar", "Baz")to nest it under "Bar"). The first build will tell you about every public symbol so you can decide what (if anything) belongs inEXPLICIT_DOC_EXCLUDES. - Group symbols on the landing page: add to
CURATED_GROUPSindocs/gen_common_index.py. Curated groups are tables only — they do not gate coverage and may safely duplicate symbols already listed by Track A.
Hiding a public symbol from docs
Add it (per package) to EXPLICIT_DOC_EXCLUDES in docs/gen_common_index.py
with an inline comment explaining why. Each entry is a deliberate decision;
unexplained entries get rejected in code review.
What the build validates
pixi run py-docs-build fails (and CI fails) on any of:
- A new top-level subpackage or module under
rerun_sdk/rerun/— or a new nested subpackage (a directory with__init__.py) under any documented package — that is neither inDOCUMENTED_PACKAGESnor inEXCLUDED_FROM_TRACK_A. This is the freshness check that prevents new modules from going silently undocumented. - A
DOCUMENTED_PACKAGESorEXCLUDED_FROM_TRACK_Aentry that no longer exists on disk (catches renames and removals). - A
DOCUMENTED_PACKAGESentry whose module has no public surface (no__all__, no redundant aliases, no in-file definitions). - A
DOCUMENTED_PACKAGESentry whose entire public surface is inEXPLICIT_DOC_EXCLUDES(the page would emitmembers: [], which is undefined in mkdocstrings). - A
CURATED_GROUPSentry that references a symbol that doesn't exist — catches stale entries when symbols are renamed or removed.
Known limitations
- PEP 562
__getattr__aliases (used for deprecated re-exports) are invisible to static analysis. To document such a name, expose it via a real redundant-alias re-export and accept the validator's prompt. - Dynamic
__all__constructions (e.g.,__all__ = list(SOMETHING)) are not supported; keep__all__a static list/tuple of string constants.
Getting started with docs
Serving the docs locally
This will watch the contents of the rerun_py folder and refresh documentation live as files are changed.
pixi run py-docs-serve
How versioned docs are generated and served
Our documentation is versioned with releases and generated via mkdocs.
The mkdocs dependencies are managed via uv (see the docs dependency group in pyproject.toml).
The documentation exists as bucket on GCS which is hosted on the https://ref.rerun.io domain.
Every commit that lands to main will generate bleeding edge documentation as HEAD. Behind the scenes, a
GitHub action is running pixi run py-docs-build, and uploading the result to GCS at
docs/python/main.
Releases will push to a version instead: docs/python/0.23.3