Skip to main content

OpenDocs

OpenDocs is a Python SDK that converts caller-provided local documents into Markdown. The 0.1.0 Alpha supports TXT, Markdown, standalone images, native/hybrid/visual PDF parsing, and native DOCX/PPTX extraction through stable sync/async APIs.

The Python distribution name is opendocs-sdk, while the import package remains opendocs.

pip install opendocs-sdk==0.1.0

Install from an existing checkout

From a separate consuming project, point the dependency at a local OpenDocs checkout that contains pyproject.toml. The examples below assume your consumer project and the OpenDocs checkout are sibling directories, so ../OpenDocs resolves to this checkout. These commands were verified against a local checkout flow; do not assume the current remote default branch is installable.

uv add ../OpenDocs
pip install ../OpenDocs

Quick start

Synchronous local-path example:

from opendocs import parse

markdown = parse("notes.md")

Asynchronous bytes example:

import asyncio

from opendocs import aparse


async def main() -> str:
    markdown = await aparse(b"plain text")
    return markdown


markdown = asyncio.run(main())

Accepted inputs:

  • local filesystem path as str
  • local filesystem path as os.PathLike[str]
  • bytes
  • binary file object with read() -> bytes

Callers own all remote downloads. http://, https://, oss://, and s3:// sources must be downloaded before calling OpenDocs.

Current behavior

parse() and aparse() return Markdown strings only. Image and visual PDF work uses the provider-neutral LiteLLM adapter when a VisionConfig is supplied. Native and blank PDF pages do not call a model or invoke Poppler. Poppler's pdftoppm executable is checked lazily only when a PDF page must be rasterized for hybrid or full-vision parsing.

Install Poppler with your platform package manager before parsing visual PDFs (for example, brew install poppler on macOS or apt-get install poppler-utils on Debian/Ubuntu). Pillow, pdfplumber, LiteLLM, python-docx, and python-pptx are installed as Python dependencies of opendocs-sdk.

from opendocs import ParseOptions, VisionConfig, parse

markdown = parse(
    "scan.pdf",
    options=ParseOptions(timeout=300, max_pages=100, vision_concurrency=4),
    vision=VisionConfig(
        model="openai/gpt-4o-mini",
        api_key="...",  # Prefer an environment-backed secret in production.
    ),
)

Standalone images require VisionConfig. PDFs and Office documents without vision configuration preserve usable native content and emit deterministic warnings for visual regions; a document with no usable native content raises VisionRequiredError. Model authentication, permission, invalid request, temporary unavailability, and invalid response failures use distinct typed exceptions. ParseOptions bounds the document timeout, PPTX/PDF page count, complete-block output size, and visual concurrency.

ParseOptions.vision_concurrency limits visual requests within one parse. Applications control cross-document concurrency themselves, for example with an asyncio.Semaphore; see the independent consumer example. OpenDocs does not provide a process-wide semaphore, model-call/token/currency cap, or performance SLA.

DOCX extraction preserves authored body paragraphs, headings, lists, safe links, tables, merged cells, explicit page breaks, and inline raster-image positions. A DOCX remains one continuous logical flow; max_pages does not infer physical Word pages. PPTX extraction emits every slide boundary and traverses each slide's shape tree in source order, including recursive groups, text, tables, accessible chart data, and raster pictures. Exact duplicate embedded images are analyzed once per parse and replayed at every authored slot.

Current format matrix

Format Status in M2 Notes
TXT Available Parsed end to end into deterministic Markdown
Markdown (.md, .markdown) Available Preserved for named Markdown paths/streams; unnamed UTF-8 bytes intentionally detect as TXT
PDF Available Per-page native, hybrid, full-vision, or blank routing; source-ordered page boundaries and tables
PNG / JPEG / WebP Available Static images only; sanitized before the configured vision model sees them
DOCX Available Continuous authored body flow with structured text, lists, links, tables, explicit breaks, and inline images
PPTX Available Slide and shape-tree order with text, tables, accessible charts, groups, and inline images

The release-blocking platform matrix is Ubuntu and macOS on Python 3.11, 3.12, and 3.13, with Poppler installed. Windows is unverified for 0.1.0 and is not claimed as supported or broken.

OpenDocs never downloads HTTP, OSS, or S3 URLs, including Office hyperlink targets and external relationships. Model calls may send sanitized images to the provider selected by VisionConfig; review that provider's privacy and cost terms before enabling vision.

Warnings and errors

OpenDocs uses Python warnings for recoverable degradation and typed exceptions for fatal failures.

import warnings

from opendocs import OpenDocsError, OpenDocsWarning, ParseOptions, parse

with warnings.catch_warnings(record=True) as caught:
    warnings.simplefilter("always", OpenDocsWarning)
    markdown = parse(
        b"first paragraph\n\nsecond paragraph\n",
        options=ParseOptions(max_output_chars=16),
    )

assert markdown == "first paragraph\n"
assert caught[0].message.code == "output_truncated"

try:
    parse("slides.pdf")
except OpenDocsError as error:
    print(error.code, error.retryable)

Project docs

Download files

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

Source Distribution

opendocs_sdk-0.1.0.tar.gz (410.3 kB view details)

Uploaded Source

Built Distribution

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

opendocs_sdk-0.1.0-py3-none-any.whl (83.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: opendocs_sdk-0.1.0.tar.gz
  • Upload date:
  • Size: 410.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for opendocs_sdk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 caf50ca106ea6b5ff6da13cd71e96d892dd39dc73934912cecd308329e80b157
MD5 5a5e8724cd53e5bb951fa7067e13872a
BLAKE2b-256 9b85b0fb40809cf22e360307b3e9ea4be4a19935be1b4f96d2a3a0c3604f0642

See more details on using hashes here.

Provenance

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

Publisher: release.yml on caichuanwang/OpenDocs

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

File details

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

File metadata

  • Download URL: opendocs_sdk-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 83.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for opendocs_sdk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1e71d346f7bf284b09f74ffe384d710ac9df853cb38c9bc58fde159b637b1176
MD5 741924326eb01f42782a00455cf9560e
BLAKE2b-256 982789013099e34bde678ef2a3c920d23973db6ea0204c39f3dfc7b996f9eb40

See more details on using hashes here.

Provenance

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

Publisher: release.yml on caichuanwang/OpenDocs

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