Skip to main content

olgadoc

Four formats. One engine. 15–40× faster.

Spatial fidelity at native speed, across PDF, DOCX, XLSX, and HTML. One Document API. mypy --strict clean. No LLM in the loop.

Python bindings for Olga — a Rust document-processing engine. Built on PyO3 and maturin; one abi3 wheel covers CPython 3.8+.

Install

pip install olgadoc

Ten-second tour

import olgadoc

doc = olgadoc.Document.open("report.pdf")
print(doc.format, doc.page_count)           # ('PDF', 12)

# Will this document produce text, or does it need OCR first?
report = doc.processability()
if report.is_blocked():
    raise SystemExit([b["kind"] for b in report.blockers])

# Full-text search
for hit in doc.search("quarterly revenue"):
    print(hit["page"], hit["snippet"])

# Structured JSON tree — discriminated on ``type``
for element in doc.to_json()["elements"]:
    if element["type"] == "heading":
        print(f"h{element['level']}: {element['text']}")

Why olgadoc

  • Four formats, one API. PDF, DOCX, XLSX, and HTML all expose the same Document / Page surface. Stop juggling pdfplumber + python-docx + openpyxl + BeautifulSoup.
  • Native speed. PDF 4–8 ms · DOCX 2 ms · XLSX 1–12 ms · HTML 1–5 ms. 15–40× faster than the quality-equivalent tool on every format (benchmarks). A post-release independent reproducible audit on a 50-file mixed corpus finds olgadoc 1.62× faster and 2.62× richer in extracted content than a hand-routed best-of-breed pipeline (report).
  • Spatial fidelity, intact. Tables stay tables. Columns stay columns. Figure captions stay next to their figures. Layout carries meaning, and Olga preserves it across the round-trip to Markdown or to the typed JSON tree.
  • OCR pre-flight. doc.processability() tells you — before the pipeline starts — whether a document actually carries native text, or whether it's a scanned image that needs OCR first. Fail fast, save money.
  • Actually typed. Zero Any on the public surface. Every returned dict is a real TypedDict, Document.to_json() returns a discriminated union over 16 element variants, and mypy --strict narrows each branch.
  • No LLM in the loop. Reads the native content stream directly. Validated with an anti-LLM adversarial test — invisible canaries preserved byte-exact, deliberate typos intact, no hallucinations.

Typed surface, no Any

Every returned dict is a runtime TypedDict — introspectable at runtime and narrowed at type-check time.

from olgadoc import SearchHit

def show(hit: SearchHit) -> None:
    print(hit["page"], hit["snippet"])  # ok
    print(hit["nope"])                  # mypy: "SearchHit" has no key "nope"

Document.to_json() returns a DocumentJson tree whose elements are a discriminated JsonElement union over 16 variants (heading, paragraph, table, list, image, code_block, …). Mypy narrows each branch to exactly one.

vs alternatives

olgadoc pdfplumber unstructured docling
PDF ✅ ✅ ✅ ✅
DOCX ✅ — ✅ ✅
XLSX ✅ — partial partial
HTML ✅ — ✅ partial
mypy --strict clean (no Any) ✅ — — —
OCR pre-flight ✅ — — —
Provenance per element ✅ — — —
No ML model / no GPU required ✅ ✅ optional optional

What you get

  • Four formats, one API — PDF, DOCX, XLSX, HTML through Document.
  • Processability report — Document.processability() → blockers (including EmptyContent for scanned PDFs) and degradations.
  • Cross-page tables — anchored on the first page with is_cross_page.
  • Hyperlinks, images, outline, RAG chunks, case-insensitive search.
  • Structured JSON tree — Document.to_json(), discriminated union over 16 element variants.

Examples

Five runnable scripts live in examples/:

  • quickstart.py — open a document, print a per-page preview.
  • extract_tables.py — pull every reconstructed table as TSV.
  • batch_processability.py — recursively health-check a directory.
  • search_and_extract.py — search + print surrounding page text.
  • json_walk.py — walk the typed JSON tree and narrow by type.

Building from source

pip install maturin
cd olgadoc
maturin develop --release
pytest tests/ -q

License

Apache License 2.0.

Release files for olgadoc 0.1.3

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

Source distribution (sdist)

Source distribution for olgadoc 0.1.3
File Size Uploaded
olgadoc-0.1.3.tar.gz 6.0 MB Details

Built distributions (wheels)

Table of built distributions (wheels) for olgadoc 0.1.3
File
olgadoc-0.1.3-cp38-abi3-win_amd64.whl CPython 3.8 abi3 Windows x86-64 Details
olgadoc-0.1.3-cp38-abi3-musllinux_1_2_x86_64.whl CPython 3.8 abi3 Linux musl 1.2+ x86-64 Details
olgadoc-0.1.3-cp38-abi3-musllinux_1_2_aarch64.whl CPython 3.8 abi3 Linux musl 1.2+ ARM64 Details
olgadoc-0.1.3-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.8 abi3 Linux glibc 2.17+ x86-64 Details
olgadoc-0.1.3-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.8 abi3 Linux glibc 2.17+ ARM64 Details
olgadoc-0.1.3-cp38-abi3-macosx_11_0_arm64.whl CPython 3.8 abi3 macOS 11.0+ ARM64 Details
olgadoc-0.1.3-cp38-abi3-macosx_10_12_x86_64.whl CPython 3.8 abi3 macOS 10.12+ x86-64 Details

Total release size: 49.0 MB

Release files / olgadoc-0.1.3.tar.gz

Download URL olgadoc-0.1.3.tar.gz
Size 6.0 MB
Tags Source
SHA-256 checksum
How to use checksums
b5c71b2bb5e1e9c4fc4b954b8f6184da6d7d738b63f10a00f861c410ea64bf35
BLAKE2b-256 checksum
How to use checksums
26f44976548d44d973fb2c3ffb41789842ab0995765542329208fee313c24aff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 May 26, 2026.

Transparency log

Release files / olgadoc-0.1.3-cp38-abi3-win_amd64.whl

Download URL olgadoc-0.1.3-cp38-abi3-win_amd64.whl
Size 5.2 MB
Tags CPython 3.8 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
7d3e3c537119052757b333f757a9228405964389b2301b00244b1530da72cef1
BLAKE2b-256 checksum
How to use checksums
83bae1c2511560d0179b107cf5d26e24ab19fa6c5ce8fa3f10f8fd54bd05a9c2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 May 26, 2026.

Transparency log

Release files / olgadoc-0.1.3-cp38-abi3-musllinux_1_2_x86_64.whl

Download URL olgadoc-0.1.3-cp38-abi3-musllinux_1_2_x86_64.whl
Size 6.1 MB
Tags CPython 3.8 Linux musl 1.2+ x86-64 abi3
SHA-256 checksum
How to use checksums
cb88b0c48349ffc7e490cce1f7fc6c96520bacc851cac15126347d59bfa1feca
BLAKE2b-256 checksum
How to use checksums
3cc0f924d9224ebfd5ec6c6ab41bc3126727f807741d100a4db5b41b157a8585
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 May 26, 2026.

Transparency log

Release files / olgadoc-0.1.3-cp38-abi3-musllinux_1_2_aarch64.whl

Download URL olgadoc-0.1.3-cp38-abi3-musllinux_1_2_aarch64.whl
Size 5.9 MB
Tags CPython 3.8 Linux musl 1.2+ ARM64 abi3
SHA-256 checksum
How to use checksums
9a9f5e170921cde1834619baaee4e02622139f8456876505ebef4a7f711f6a16
BLAKE2b-256 checksum
How to use checksums
7b8d2f7cc455476ecf5a04ee6420d4e5e9eb9f69b6aa61ac624420b9806e092f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 May 26, 2026.

Transparency log

Release files / olgadoc-0.1.3-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL olgadoc-0.1.3-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 5.4 MB
Tags CPython 3.8 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
134b2bf37c0ecfc3ca14810e994fac6d181d4876ca407656a1de816aabf3356c
BLAKE2b-256 checksum
How to use checksums
38f17b61c89401551a91611bac9fc8bc44178943352dbdeb75f976611715cfa4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 May 26, 2026.

Transparency log

Release files / olgadoc-0.1.3-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL olgadoc-0.1.3-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 5.1 MB
Tags CPython 3.8 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
e10da7a9e928ffa65478afec7b6d4b247563a7b03d8c25ca9f18dce65797899e
BLAKE2b-256 checksum
How to use checksums
ad86f78f558b23646d487bc9672caba745ac1feaaf03c8c52608e88796c67d2d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 May 26, 2026.

Transparency log

Release files / olgadoc-0.1.3-cp38-abi3-macosx_11_0_arm64.whl

Download URL olgadoc-0.1.3-cp38-abi3-macosx_11_0_arm64.whl
Size 7.5 MB
Tags CPython 3.8 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
3c2e37d05e83ce91d12f15bd4585eaf4b6abbe6dbe44511555236d543f158863
BLAKE2b-256 checksum
How to use checksums
6e4f1904614bcf8254e58cedcd8107ff269a282854baa664e7f147172167100e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 May 26, 2026.

Transparency log

Release files / olgadoc-0.1.3-cp38-abi3-macosx_10_12_x86_64.whl

Download URL olgadoc-0.1.3-cp38-abi3-macosx_10_12_x86_64.whl
Size 7.8 MB
Tags CPython 3.8 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
35b379853b5114d8058b715f0068fc346e10188f4e15f81c183baf9c9fff00e0
BLAKE2b-256 checksum
How to use checksums
4481e1d7c30efaec050804ee295d85f57f1ebb17235c4642bf4c5bd6f7c78b00
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 May 26, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.3 This release

8 release files

0.1.2

8 release files

0.1.1

8 release files

0.1.0

8 release 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