Skip to main content

pyodr — Python bindings for OpenDocument.core

Decode office documents (ODF, OOXML, legacy MS binary, PDF, CSV, ...) and render them to HTML from Python.

import pyodr

file = pyodr.open("document.odt")
print(pyodr.file_type_to_string(file.file_type()))

service = pyodr.html.translate(file, "cache-dir", pyodr.HtmlConfig())
html = service.bring_offline("output-dir")
for page in html.pages():
    print(page.name, page.path)

A small CLI is included: pyodr <file> renders a document and opens it in the browser; pyodr <file> --serve hosts it over HTTP (via the core HTTP server, available when built with ODR_WITH_HTTP_SERVER).

Building

The bindings are part of the main CMake build, toggled by ODR_PYTHON:

conan install . -o '&:with_python=True' --build missing
cmake -B build -S . -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake -DODR_PYTHON=ON
cmake --build build --target pyodr_core
PYTHONPATH=build/python ODR_CORE_DATA_PATH=build/data python -m pytest python/tests

pip install . from the repository root builds a wheel via scikit-build-core (see the root pyproject.toml); run conan install first and point CMAKE_ARGS at the generated conan_toolchain.cmake so the C++ dependencies resolve. Wheels bundle libmagic's database, so match that option:

conan install . -o '&:with_python=True' -o '&:bundle_assets=True' --build missing
CMAKE_ARGS="-DCMAKE_TOOLCHAIN_FILE=$PWD/conan_toolchain.cmake" pip install .

Runtime data

Rendering uses shipped assets (CSS/JS), and MIME detection uses libmagic's compiled database (magic.mgc). Wheels bundle both under pyodr/data and pick them up automatically. For in-tree builds set ODR_CORE_DATA_PATH (the tests read it) and, if needed, ODR_LIBMAGIC_DATABASE_PATH, or call pyodr.GlobalParams.set_odr_core_data_path(...) / set_libmagic_database_path(...).

Neither is fatal when missing: without the assets, rendering fails on the individual resource; without the database, odrcore tries the system database and then falls back to its own magic sniffing (which sees an .odt as application/zip rather than the ODF type).

Download files

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

Source Distribution

pyodr-6.0.1.tar.gz (1.1 MB view details)

Uploaded Source

Built Distributions

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

pyodr-6.0.1-cp314-cp314-manylinux_2_39_x86_64.whl (3.5 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.39+ x86-64

pyodr-6.0.1-cp314-cp314-macosx_26_0_arm64.whl (2.5 MB view details)

Uploaded CPython 3.14macOS 26.0+ ARM64

File details

Details for the file pyodr-6.0.1.tar.gz.

File metadata

  • Download URL: pyodr-6.0.1.tar.gz
  • Upload date:
  • Size: 1.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for pyodr-6.0.1.tar.gz
Algorithm Hash digest
SHA256 eba3cbd3afe081635b5744a8e28fbf213281fc7cd552e0c7d1c49ed41338e1b3
MD5 b772f633d7b875e7c9a493e237567b3f
BLAKE2b-256 9f2fb8dd1b67b41f865d0f2c634ac141a796e15c55f6e57f7bf0ed1e01fb8a80

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyodr-6.0.1.tar.gz:

Publisher: python.yml on opendocument-app/OpenDocument.core

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

File details

Details for the file pyodr-6.0.1-cp314-cp314-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for pyodr-6.0.1-cp314-cp314-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 4a0fa644761edb9c19c5c9042d6e620c80bcdc1cb206d4bffd45b2a7c1a89f30
MD5 52478a03d5a9f93111b50ba732123501
BLAKE2b-256 7ec4a675e33c4aa60a101c7a4eb7e9af43056faa21de63b2a71b77f814ae396f

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyodr-6.0.1-cp314-cp314-manylinux_2_39_x86_64.whl:

Publisher: python.yml on opendocument-app/OpenDocument.core

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

File details

Details for the file pyodr-6.0.1-cp314-cp314-macosx_26_0_arm64.whl.

File metadata

File hashes

Hashes for pyodr-6.0.1-cp314-cp314-macosx_26_0_arm64.whl
Algorithm Hash digest
SHA256 5064c82ca4209fa463ac1967e99425eb4b07bbd2f368aa7c94329dfc1f9e4c1c
MD5 2335408615fd34b6f413d319b043aadf
BLAKE2b-256 b6fc979d8e4b412f3c04ead14a5a0f1fdde7300354f929e7ee3d413daec27ea4

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyodr-6.0.1-cp314-cp314-macosx_26_0_arm64.whl:

Publisher: python.yml on opendocument-app/OpenDocument.core

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 Sentry Error logging StatusPage Status page