Rewrite Python Docs
Use source code as the source of truth. Treat existing docs, docstrings, tests, and examples only as weak hints.
Guidelines
- Inspect
pyproject.toml, zensical.toml, noxfile.py, .config/mise/, public exports, source code, and tests before editing.
- Run
scripts/gen-ref-pages.py to regenerate reference pages under docs/reference/. The script will output a navigation table that can be copy-pasted into zensical.toml.
- Files to update:
- docstrings in source code
docs/ (excluding generated docs/reference/)
- description in
pyproject.toml and zensical.toml
- inventories in
zensical.toml if needed
- DO NOT EDIT:
- generated reference pages under
docs/reference/
- Existing docs, docstrings, tests, examples may be rough, missing, incomplete or misleading, it only serves as weak hint.
- Favor bold, comprehensive rewrites over minor or incremental edits.
- Keep docs concise, fluent, example-first.
- Source code is the source of truth.
- Use Google style docstrings. Read google-style.md for details.
- Prefer
Examples: sections with compact doctests for public APIs when the example is deterministic, useful, and runnable.
- Treat doctests as executable tests, not decorative snippets; keep fixture-heavy, parametrized, or unstable behavior in
tests/.
- Use markdown in docstrings:
- Use single backticks for inline code, NOT double backticks.
- Cross-references are written as Markdown reference-style links: [
Object 1][full.path.object1].
Suggested Layout
docs/
README.md
getting-started/
...
guides/
...
concepts/
...
reference/ # generated, DO NOT EDIT
package/
README.md
submodule.md
advanced/
...
- Keep only the sections the project needs.
- Keep navigation shallow.
mkdocstrings Notes
- The project uses
zensical with mkdocstrings.
- The
__init__ method is merged into the class' signature and docstring.
- The first line in
__init__ methods' docstrings is ignored.
Validation
- Run
rumdl fmt .. Treat its findings as weak hints, not strong constraints.
- Run
uv run pytest ... for changed doctests.
- Run
mise run lint.
- Run
mise run docs:build.
- If validation fails for unrelated reasons, separate those failures from the docs change and report them clearly.
1---2name: rewrite-python-docs3description: Rewrite Python docs and docstrings from source code. Use when Codex needs to refresh docs, add executable doctest examples, update Google-style docstrings, or regenerate zensical/mkdocstrings reference pages.4---56# Rewrite Python Docs78Use source code as the source of truth. Treat existing docs, docstrings, tests, and examples only as weak hints.910## Guidelines1112- Inspect `pyproject.toml`, `zensical.toml`, `noxfile.py`, `.config/mise/`, public exports, source code, and tests before editing.13- Run `scripts/gen-ref-pages.py` to regenerate reference pages under `docs/reference/`. The script will output a navigation table that can be copy-pasted into `zensical.toml`.14- Files to update:15 - docstrings in source code16 - `docs/` (excluding generated `docs/reference/`)17 - description in `pyproject.toml` and `zensical.toml`18 - inventories in `zensical.toml` if needed19- DO NOT EDIT:20 - generated reference pages under `docs/reference/`21- Existing docs, docstrings, tests, examples may be rough, missing, incomplete or misleading, it only serves as weak hint.22- Favor bold, comprehensive rewrites over minor or incremental edits.23- Keep docs concise, fluent, example-first.24- Source code is the source of truth.25- Use Google style docstrings. Read [google-style.md](./references/google-style.md) for details.26- Prefer `Examples:` sections with compact doctests for public APIs when the example is deterministic, useful, and runnable.27- Treat doctests as executable tests, not decorative snippets; keep fixture-heavy, parametrized, or unstable behavior in `tests/`.28- Use markdown in docstrings:29 - Use single backticks for inline code, NOT double backticks.30 - Cross-references are written as Markdown reference-style links: [`Object 1`][full.path.object1].3132## Suggested Layout3334```text35docs/36 README.md37 getting-started/38 ...39 guides/40 ...41 concepts/42 ...43 reference/ # generated, DO NOT EDIT44 package/45 README.md46 submodule.md47 advanced/48 ...49```5051- Keep only the sections the project needs.52- Keep navigation shallow.5354## mkdocstrings Notes5556- The project uses `zensical` with `mkdocstrings`.57- The `__init__` method is merged into the class' signature and docstring.58- The first line in `__init__` methods' docstrings is ignored.5960## Validation6162- Run `rumdl fmt .`. Treat its findings as weak hints, not strong constraints.63- Run `uv run pytest ...` for changed doctests.64- Run `mise run lint`.65- Run `mise run docs:build`.66- If validation fails for unrelated reasons, separate those failures from the docs change and report them clearly.