Skip to main content

A teaching-first incremental Python API documentation compiler.

Project description

pyinc-docs

CI PyPI version Python versions License

pyinc-docs is a static Python API documentation compiler built as a standalone consumer of pyinc. It turns a regular Python package into a deterministic, searchable HTML site without importing or executing the package being documented.

The compiler is deliberately small enough to teach from. Its query graph makes each step visible: discover files, decode source, extract public API, link local annotations, render artifacts, and reconcile the desired site. Repeated builds reuse unchanged work, backdate semantically unchanged analysis, and repair tampered generated files.

pyinc-docs supports Python 3.11 through 3.14 and has one runtime dependency: pyinc>=3.0,<4.

Quick start

python -m pip install pyinc-docs
pyinc-docs build path/to/your_package --title "My Package API" --stats

SOURCE is the package directory itself: it must contain __init__.py. From a source checkout, build the included tutorial package with:

pyinc-docs build examples/tutorial/acme_widgets --title "Acme Widgets API" --stats

The default site is written to site/ and durable query state to .pyinc-docs/. A successful build creates this public layout:

site/
├── assets/
│   ├── search.js
│   └── style.css
├── modules/
│   └── <module>.html
├── index.html
└── symbols.json

Preview the exact reconciliation without changing the site:

pyinc-docs plan examples/tutorial/acme_widgets --title "Acme Widgets API" --stats

Watch a package during development or inspect why one module was recomputed:

pyinc-docs watch examples/tutorial/acme_widgets --interval-ms 250 --debounce-ms 150
pyinc-docs explain examples/tutorial/acme_widgets acme_widgets.models

Static API rules

The source must be one regular package directory with an __init__.py file. Regular subpackages are recursive; namespace-package gaps, duplicate module identities, source-tree symlinks, and unsafe paths are rejected.

A module's public API comes from one static __all__ list or tuple of strings. Without one, public top-level functions and classes are documented. Dynamic __all__ assignments produce a warning and fall back to that convention. Module, function, class, constructor, public method, static method, class method, and property documentation is extracted from source. Docstrings are escaped plain text rather than interpreted as Markdown or reStructuredText.

Annotation links resolve within a module and across one explicit local import, including imports guarded by TYPE_CHECKING. Explicit local re-exports named by __all__ are supported. Wildcard imports, recursive export chains, external annotations, and unresolved names remain unlinked.

Compilation is transactional from the user's point of view. Encoding errors, syntax errors, unsafe paths, and output collisions stop reconciliation, leaving the last valid site and checkpoint untouched.

Commands

pyinc-docs build SOURCE [-o site] [--state-dir .pyinc-docs] [--title TITLE] [--stats]
pyinc-docs plan SOURCE [-o site] [--state-dir .pyinc-docs] [--title TITLE] [--stats]
pyinc-docs watch SOURCE [-o site] [--state-dir .pyinc-docs] [--title TITLE]
                 [--interval-ms 250] [--debounce-ms 150] [--stats]
pyinc-docs explain SOURCE MODULE [--state-dir .pyinc-docs] [--title TITLE]
pyinc-docs cache clean [--state-dir .pyinc-docs]
pyinc-docs --version

Successful commands return 0, compiler and operational failures return 1, and invalid command-line usage returns 2.

Documentation

Development

python3 -m venv .venv
. .venv/bin/activate
python -m pip install -e '.[dev]'
pytest
python -m mypy
python -m ruff check src tests examples
python -m ruff format --check src tests examples

Generate this project's own API site with the installed command:

pyinc-docs build src/pyinc_docs -o site --title "pyinc-docs API" --stats

License

Licensed under the Apache License, Version 2.0. See LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyinc_docs-0.1.0.tar.gz (56.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyinc_docs-0.1.0-py3-none-any.whl (32.6 kB view details)

Uploaded Python 3

File details

Details for the file pyinc_docs-0.1.0.tar.gz.

File metadata

  • Download URL: pyinc_docs-0.1.0.tar.gz
  • Upload date:
  • Size: 56.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for pyinc_docs-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e2a24eaa75aa2d6cd740012f38e7727cf27a6c47f2cf65108ace79059b3748a4
MD5 128a412ba6017e2c26507a2465639660
BLAKE2b-256 c72027d9f3aa78ecc5f731cf3f102f5282c54e4c005489d9b9f8736bfce392f7

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyinc_docs-0.1.0.tar.gz:

Publisher: release.yml on Brumbelow/pyinc-docs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyinc_docs-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pyinc_docs-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 32.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for pyinc_docs-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b53413ff6da42c23d3f513e3329708e38fd8f9a7d7424435bbc9ab6ed0333ab3
MD5 eb0dba782331a8a5f7e1cb0b00b24dbe
BLAKE2b-256 43e04a662ea3550878dcb449227ab34bf6e46242c2cc565006327493bd255d81

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyinc_docs-0.1.0-py3-none-any.whl:

Publisher: release.yml on Brumbelow/pyinc-docs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page