Skip to main content

oodocs

OODocs is an Object-Oriented Documentation Tool: a Python-first toolkit for building structured documents as ordinary Python objects and rendering the same source to DOCX, PDF, HTML, and EPUB.

It is useful when reports, manuals, API references, manuscripts, or release documents already live near Python data, figures, and scripts. Instead of treating a document as a string template, OODocs keeps the source of record as a typed object tree.

Install

pip install oodocs

OODocs requires Python 3.11 or later.

Optional extras are available for focused workflows:

pip install "oodocs[examples]"
pip install "oodocs[integrations]"
pip install "oodocs[bibtex]"
pip install "oodocs[pint]"
pip install "oodocs[sympy]"
pip install "oodocs[apidoc]"
  • examples installs dependencies used by the bundled example scripts, such as matplotlib and pandas.
  • integrations installs PyYAML and Pydantic support for their optional collectors.
  • bibtex installs the optional bibtexparser backend; the built-in parser remains available without it.
  • pint and sympy install only their respective integration bridges.
  • apidoc installs API collection and docstring parsing dependencies.

Core engineering presentation objects such as NumberFormat and Quantity need no optional dependency.

Quick Start

from oodocs import Chapter, Document, DocumentMetadata, DocumentSettings, Paragraph, Section, bold

report = Document(
    "Hello oodocs",
    Chapter(
        "Getting Started",
        Section(
            "Overview",
            Paragraph(
                "This document was defined with ",
                bold("Python objects"),
                ".",
            ),
        ),
    ),
    settings=DocumentSettings(metadata=DocumentMetadata(author="OODocs")),
)

report.save("artifacts/hello.docx")
report.save("artifacts/hello.pdf")
report.save("artifacts/hello.html")
report.save("artifacts/hello.epub")

Document.save(...) chooses the renderer from the file extension. Use save_all(...) when a workflow normally needs DOCX, PDF, and HTML together:

outputs = report.save_all("artifacts")
print(outputs["docx"], outputs["pdf"], outputs["html"])

Select EPUB explicitly with report.save_epub("artifacts/hello.epub") or report.save_all("artifacts", formats=("html", "epub")). EPUB bundles images and reader navigation without extra dependencies. Reader settings control page numbers and reflow; fixed page layouts can differ from DOCX/PDF.

Command Line

The package installs an oodocs command for common build and validation tasks:

oodocs build report.py --out artifacts
oodocs build README.md --outputs docx,pdf,html --out artifacts
oodocs build notebook.ipynb --outputs pdf --out artifacts
oodocs build report.py --outputs epub --out artifacts
oodocs validate report.py

Python sources can expose a Document as document, doc, or report, or a zero-argument factory such as build_document(). Markdown and notebook sources are imported through the same parser APIs available from Python. Because a Python source is imported during discovery, build only trusted Python files and keep command execution behind an if __name__ == "__main__" guard.

What You Can Build

  • DOCX, PDF, HTML, and EPUB documents from one Python object tree
  • document-level page layout for page size, margins, and portrait/landscape orientation
  • authored prose, headings, lists, equations, code blocks, boxes, tables, and figures
  • captioned tables and figures with automatic numbering and cross-references
  • explicit cover/front/main/back matter, cover item order and flexible spacing, plus plain object links for unnumbered targets
  • description lists, schema and CLI reference models, per-line equation references, quantities, and multi-document suites
  • report panels and reusable visual styles that stay editable in Word
  • document comments, footnotes, hyperlinks, citations, and generated references
  • Markdown and Jupyter notebook imports that become editable OODocs blocks, including multi-file Markdown assembly with internal links and relative assets
  • API reference material from Python packages, modules, source trees, and docstrings through oodocs.apidoc
  • release and audit documents from generic metadata models, explicit oodocs.integrations, and caller-configured oodocs.evidence reports

API Documentation Workflows

Install the apidoc extra to collect public Python API objects and render them as ordinary OODocs content:

from oodocs import Chapter, Document, Paragraph
from oodocs.apidoc import collect_api

api = collect_api("oodocs", public_policy="__all__")
classes = api.select_objects(kind="class", module_prefix="oodocs.components")

doc = Document(
    "Selected API Notes",
    Chapter(
        "Important Classes",
        Paragraph("This chapter is assembled from parsed API objects."),
        *[obj.to_section(level=2, presentation="manual") for obj in classes[:5]],
    ),
)

doc.save_all("artifacts/api-notes")

Repository-level API reference builds can also be configured in pyproject.toml and rendered with ApiHelpBookConfig.from_pyproject(".").save_all(".").

Upgrading to 1.3

Version 1.3 removes oodocs.adapters; import external collectors from oodocs.integrations.*. Replace Equation.from_sympy(...) with oodocs.integrations.sympy.equation_from_sympy(...), and import schema, CLI, engineering, evidence, and suite models from their focused namespaces. See the v1.3 migration guide.

Metadata

Release files for oodocs 1.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for oodocs 1.4.0
File Size Uploaded Provenance Actions
oodocs-1.4.0.tar.gz 6.9 MB With provenance Details for oodocs-1.4.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for oodocs 1.4.0
File Interpreter ABI Platform Actions
oodocs-1.4.0-py3-none-any.whl Python 3 none any Details for oodocs-1.4.0-py3-none-any.whl

Total release size: 7.4 MB

Release files / oodocs-1.4.0.tar.gz

Download URL oodocs-1.4.0.tar.gz
Size 6.9 MB
Tags Source
SHA-256 checksum
How to use checksums
55c6273209ad40bab964dd043922f1d1651f557bc81ba7ce4cee58bc7e2350ab
BLAKE2b-256 checksum
How to use checksums
1eff3f85d9d60f687521dcec512da2fe77a5d69e7a2617f95c1e47802c9dc245
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 6, 2026.

Transparency log

Release files / oodocs-1.4.0-py3-none-any.whl

Download URL oodocs-1.4.0-py3-none-any.whl
Size 567.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cb57db67497bb178cf3f68ba5162504e64c322e6fc006d1439f645837dcc1468
BLAKE2b-256 checksum
How to use checksums
007a29e5a8a61fb844264f525e6eb085e92ee0cc6a72a5d671e869f8a6921aa9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 6, 2026.

Transparency log

Security for oodocs 1.4.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for oodocs-1.4.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 6, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page