Skip to content

feat(reference): one API reference page per package, re-exports as tables - #9

Merged
serendip-ml merged 2 commits into
developfrom
feat/reference-per-module
Nov 19, 2026
Merged

serendip-ml merged 2 commits into
developfrom
feat/reference-per-module

Conversation

@serendip-ml

@serendip-ml serendip-ml commented Nov 19, 2026 •

Copy link
Copy Markdown
Member

The generated API reference put each top-level module and all its submodules on one page (appinfra.app came to ~3 MB and over a second to load), and documented every re-exported class in full under each package that exported it.

Reference structure

  • One page per package and subpackage, nested in the nav the way the packages nest (docsite/reference.py). A package's own .py files get no pages; its API is what its __init__ exports. Each page links its subpackages, and the API reference page renders the package's top level the same way.
  • Re-exports as tables (docsite/reexports.py, a griffe extension). A name a package exports that another public package defines and exports is listed in an Exports table, linked to the page where it is documented. Everything else the package exports is documented in full on its page.
  • show_submodules = false and filters = ["!^_"]: a page holds only its package's public members.

Page details

  • Import line on each package-level class, function, attribute and type alias: >>> from <package> import <name> at the right of its heading, highlighted, with the theme's copy button (template overrides in overrides/mkdocstrings).
  • Examples as console sessions: docstring examples that parse as Python are shown with >>> and ..., like the ones written as doctests. Copying a session leaves out prompts and output.
  • One code size (13.6px); code in tables and example boxes was 10.9px.

Package order

Packages are listed from agents down to the foundation (llm-gent, llm-kelt, llm-saia, llm-infer, appinfra) in the nav and on the home and Packages pages.

Result

All 105 pages load in under 220 ms locally (median 42 ms). The largest reference page is 343 KB; appinfra.app's page is ~17,000 px tall and loads in 0.1 s.

Summary by CodeRabbit

  • New Features

    • API reference pages now follow a nested package structure, with navigation that reflects subpackages.
    • Re-exported public names are presented in linked tables when their defining package documents them.
    • API entries include copyable Python import examples, and Python examples use interactive console prompts.
  • Documentation

    • Updated API reference configuration and page descriptions to reflect package-based pages.
    • Reordered package cards and navigation.

…bles

The reference rendered each top-level module with all its submodules
on one page: appinfra.app came to ~3 MB and took over a second to load,
and every re-exported class was documented in full under each package
that exported it.

- docsite/reference.py: a page per package and subpackage at every
  depth, nested in the nav the way the packages nest; a package's own
  .py files get no pages. Each page links its subpackages. The API
  reference page renders the package's top level the same way.
- docsite/reexports.py (griffe extension): a package's export that
  another public package defines and exports is taken off its page and
  listed in an Exports table in the docstring, linked to where it is
  documented. Everything else the package exports is documented in
  full on its page. Subpackages are found by is_init_module: griffe's
  is_package is true only for the top-level package.
- zensical.base.toml: show_submodules = false and filters ["!^_"], so
  a page holds only its package's public members.
- overrides/mkdocstrings: each package-level class, function,
  attribute and type alias shows its import line (">>> from <package>
  import <name>") at the right of its heading, highlighted, with the
  theme's copy button.
- docsite/docstring_code.py: examples that parse as Python are shown
  as console sessions (>>> and ...), like the ones written as
  doctests. Copying a session leaves out its prompts and output.
- pages/assets/extra.css: code is 13.6px everywhere; in tables and
  example boxes the theme's em sizing made it 10.9px.

appinfra.app's page is now ~17,000 px tall and loads in 0.1 s; the
largest page is 343 KB.

Signed-off-by: serendip-ml <64741025+serendip-ml@users.noreply.github.com>
Signed-off-by: serendip-ml <64741025+serendip-ml@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The API reference now follows nested public packages, documents qualifying re-exports in tables, and renders Python examples as interactive sessions. API object pages also show copyable import lines. Package navigation and reference tests reflect the updated page structure.

Changes

API Reference Generation and Rendering

Layer / File(s) Summary
Generate nested package reference pages
docsite/reference.py, etc/docsite.yaml, tests/integration/test_cli.py, tests/integration/test_reference_modules.py, tests/unit/test_reference_pages.py, pages/index.md, pages/packages/index.md, zensical.base.toml
Reference pages and navigation now follow recursively discovered public subpackages. Tests check the nested page structure, and package cards and navigation entries are reordered.
Filter and document package re-exports
docsite/reexports.py, tests/integration/test_reexports.py, zensical.base.toml
The Exports extension removes qualifying public aliases from package members and appends tables for those names. The configuration enables the extension and filters private names.
Render Python examples and import lines
docsite/docstring_code.py, tests/unit/test_docstring_code.py, overrides/mkdocstrings/python/material/*, pages/assets/extra.css, zensical.base.toml
Python examples render as pycon sessions. API object templates add copyable import lines, and CSS styles those lines and code blocks.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Possibly related PRs

  • llm-works/docs#4: Adds the docstring example extension and its tests, which the Python session rendering changes directly modify.
  • llm-works/docs#3: Establishes API reference generation, which this change updates to generate package and subpackage pages and document re-exports.
Merge Risk: Minimal · up to 1ca4c

This change restructures the generated API reference into per-package pages and adds import lines and console-style examples. It affects documentation output only, and no concrete problems were identified, so it looks ready to merge.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the two main changes: one API reference page per package, and re-exports rendered as tables. The changeset matches both. The reference.py, reexports.py, and template changes all implem…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the two main changes: one API reference page per package, and re-exports rendered as tables. The changeset matches both. The reference.py, reexports.py, and template changes all implement these. The title is concise and specific, and it follows conventional commit style. It omits the import lines, console-style examples, and package ordering, which is expected for a title.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 3ca55a5 and 1ca4c10.

Files selected for processing: 18

  • docsite/docstring_code.py
  • docsite/reexports.py
  • docsite/reference.py
  • etc/docsite.yaml
  • overrides/mkdocstrings/python/material/_import.html.jinja
  • overrides/mkdocstrings/python/material/attribute.html.jinja
  • overrides/mkdocstrings/python/material/class.html.jinja
  • overrides/mkdocstrings/python/material/function.html.jinja
  • overrides/mkdocstrings/python/material/type_alias.html.jinja
  • pages/assets/extra.css
  • pages/index.md
  • pages/packages/index.md
  • tests/integration/test_cli.py
  • tests/integration/test_reexports.py
  • tests/integration/test_reference_modules.py
  • tests/unit/test_docstring_code.py
  • tests/unit/test_reference_pages.py
  • zensical.base.toml

Included review availability: This review used your included allowance. 1 included review remains after this review. Your included PR review attempts over the past 7 days set your current allowance at 2 reviews per hour.

@serendip-ml
serendip-ml merged commit ca2e3f1 into develop Nov 19, 2026
6 checks passed
@serendip-ml
serendip-ml deleted the feat/reference-per-module branch November 19, 2026 05:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant