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, and HTML.

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")

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"])

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 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, and HTML 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 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
  • 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 from 1.x

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.

Links

Download files

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

Source Distribution

oodocs-1.3.0.tar.gz (6.7 MB view details)

Uploaded Source

Built Distribution

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

oodocs-1.3.0-py3-none-any.whl (467.5 kB view details)

Uploaded Python 3

File details

Details for the file oodocs-1.3.0.tar.gz.

File metadata

  • Download URL: oodocs-1.3.0.tar.gz
  • Upload date:
  • Size: 6.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for oodocs-1.3.0.tar.gz
Algorithm Hash digest
SHA256 82ed366c382ec86426b19449883f29043e73789819c29627307cb6729a1f5b54
MD5 4564b4ae4c1416856b456047e1a715c4
BLAKE2b-256 3271f2bbfe778405dfa767787ce431bb805c81c6c14ec318185f10cb2334ccbd

See more details on using hashes here.

Provenance

The following attestation bundles were made for oodocs-1.3.0.tar.gz:

Publisher: release.yml on Gonie-Gonie/oo-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 oodocs-1.3.0-py3-none-any.whl.

File metadata

  • Download URL: oodocs-1.3.0-py3-none-any.whl
  • Upload date:
  • Size: 467.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for oodocs-1.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 841ea2a6ff3a0305ef32974e72e2220bfd1b59d4d3689cf5bd7b50fd95554c11
MD5 d4ce241341c1a21ffe290bc3a6813d50
BLAKE2b-256 003d50152adf5be5486157abade5161b418daa8a04e0c803daae9adb28bc5f2d

See more details on using hashes here.

Provenance

The following attestation bundles were made for oodocs-1.3.0-py3-none-any.whl:

Publisher: release.yml on Gonie-Gonie/oo-docs

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

Release history Release notifications | RSS feed

This release

1.3.0 This release

2 files

1.2.0

2 files

1.1.0

2 files

1.0.4

2 files

1.0.3

2 files

1.0.2

2 files

1.0.1

2 files

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