Skip to main content

zenfmt

Universal document conversion as a typed, dependency-free Python library. zenfmt reads 19 formats—DOCX, DOC, ODT, RTF, XLSX, XLS, XLSB, ODS, CSV, PPTX, PPT, ODP, EPUB, PDF, HTML, Markdown, AsciiDoc, reStructuredText, and plain text—and writes clean Markdown through a native engine written in Zig. The wheel bundles the engine: no runtime dependencies, subprocesses, or network downloads are required, and the GIL is released during conversion.

pip install zenfmt
import zenfmt

# A str is always a path; the result is the whole in-memory ensemble:
# artifact bytes, embedded resources, the canonical manifest, and reports.
conversion = zenfmt.convert("report.docx")
print(conversion.text)
for report in conversion.reports:
    print(report.code, report.problem)

# Bytes are explicit; the source format is named or sniffed.
conversion = zenfmt.convert(uploaded_bytes, name="upload.docx", to="markdown")

# An output path selects transactional publication: the artifact, its media,
# and a manifest land together or not at all. Graded strictness refuses
# priced fidelity loss before anything is written.
conversion = zenfmt.convert(
    "report.docx", output="build/report.md", strict="structure"
)

Failures raise a compact exception tree (ConversionError, LimitExceededError, UnknownFormatError, …) whose messages answer the same four questions as the engine's CLI diagnostics — what happened, where, what it costs, and what you can do. Reusable policy lives in immutable zenfmt.Converter values; there is no global configuration or environment lookup. zenfmt.formats() enumerates the compiled-in format capabilities.

Every library error includes structured facts and an actionable hint. Handle stable codes in application logic and render the message for people:

try:
    zenfmt.convert(uploaded_bytes, name="upload.docx")
except zenfmt.ConversionError as error:
    log.info("conversion failed", extra={"code": error.code})
    print(error.hint)

Security and authority

A string is always a path. Passing a path explicitly authorizes zenfmt to read that file and, when present, its adjacent digest-bound .zenfmt.json manifest. Passing bytes or a binary reader grants no filesystem authority: name is display-only, is never opened, and no adjacent file is inspected. External resource references are reported in conversion.resources but are never fetched. The runtime does not read configuration from the environment, follow includes, resolve external entities, discover plugins, or use the network.

Conversion is bounded by zenfmt.Limits; the defaults cap input, decoded text, archive expansion, document structure, reports, embedded resources, and artifact output. Services handling large or untrusted documents should lower those limits and publish path output inside a per-job directory with suitable permissions and quotas. Path publication is transactional and refuses to replace an existing artifact ensemble unless overwrite=True.

The native engine runs inside the Python process with that process's authority. A wheel is not a sandbox. Workloads that need a stronger isolation boundary should perform conversion in a restricted worker process or container. Independent calls are thread-safe; create worker processes before starting conversion threads, or use the multiprocessing spawn start method.

Wheels are published for Linux (manylinux and musl, x86_64 and aarch64), macOS 12+ (x86_64 and arm64), and Windows x86_64, for CPython 3.10–3.14. Building from the source distribution requires only a Zig toolchain — the sdist carries the complete engine source under engine/.

CLI archives and Python wheels are attached to each GitHub release. This package is the Python surface of the zenfmt monorepo; the engine, design records (ZDS 0014 covers this library), and development workflow live there.

zenfmt is authored by Vikrant Rathore with assistance from Ronak Rathore.

Download files

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

Source Distribution

zenfmt-0.1.0.tar.gz (436.1 kB view details)

Uploaded Source

Built Distributions

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

zenfmt-0.1.0-py3-none-win_amd64.whl (1.0 MB view details)

Uploaded Python 3Windows x86-64

zenfmt-0.1.0-py3-none-musllinux_1_2_x86_64.whl (3.1 MB view details)

Uploaded Python 3musllinux: musl 1.2+ x86-64

zenfmt-0.1.0-py3-none-musllinux_1_2_aarch64.whl (2.9 MB view details)

Uploaded Python 3musllinux: musl 1.2+ ARM64

zenfmt-0.1.0-py3-none-manylinux_2_17_x86_64.whl (3.1 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ x86-64

zenfmt-0.1.0-py3-none-manylinux_2_17_aarch64.whl (2.9 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ ARM64

zenfmt-0.1.0-py3-none-macosx_12_0_x86_64.whl (1.0 MB view details)

Uploaded Python 3macOS 12.0+ x86-64

zenfmt-0.1.0-py3-none-macosx_12_0_arm64.whl (950.0 kB view details)

Uploaded Python 3macOS 12.0+ ARM64

File details

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

File metadata

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

File hashes

Hashes for zenfmt-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a41d8261bb31206c38f77340ccb1800f5ce1797175c1a463d62f99cc905f39c9
MD5 0c144613f9a6dd7cf60ea2f99174740b
BLAKE2b-256 1d46adf3214ba08e3ba6745b1616a900cea4310f239f5c3be52ccab2a631ab6f

See more details on using hashes here.

File details

Details for the file zenfmt-0.1.0-py3-none-win_amd64.whl.

File metadata

  • Download URL: zenfmt-0.1.0-py3-none-win_amd64.whl
  • Upload date:
  • Size: 1.0 MB
  • Tags: Python 3, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for zenfmt-0.1.0-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 b7dd6fbde5d95fd83706977e2be69fe41ea8097135e7c01354a4d7ef116918ab
MD5 9bcc7dc1c7242f605769d3acd1c916b2
BLAKE2b-256 3b5339e6cc9b1a71c941447352a7a8d45c31722924c3d7ee7ac31613571c5b34

See more details on using hashes here.

File details

Details for the file zenfmt-0.1.0-py3-none-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for zenfmt-0.1.0-py3-none-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 4a71f1be4e2e9cf928f1569d93e35ffa28f7111e3292322cf6154f951f044499
MD5 c2076aab4ac5d3c55bdf220678b4365d
BLAKE2b-256 fa85ca71515830cb72010a6cbf9e10e105be4bcefd3b1c0a565fa30d1b52ab68

See more details on using hashes here.

File details

Details for the file zenfmt-0.1.0-py3-none-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for zenfmt-0.1.0-py3-none-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 9f66a54d8b5e749ee350a80818c598c65aa2dcf99b4ab70bf0402c0a48383ec4
MD5 5a11d24536a24186ea81a9447f62787f
BLAKE2b-256 1a45d491771b7a432b326aa5eef3555ade002fd0a8fce42a19a733703857e70e

See more details on using hashes here.

File details

Details for the file zenfmt-0.1.0-py3-none-manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for zenfmt-0.1.0-py3-none-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 1f5f90e8c3bfa58869443b7106cc8cf963311fe23296755353a72c0ddee62806
MD5 e24b22cf3098a458ec34954d83e148b2
BLAKE2b-256 fd7bff1086f52961136fb60c918e892bac136d9c856423dcdd93820d58203339

See more details on using hashes here.

File details

Details for the file zenfmt-0.1.0-py3-none-manylinux_2_17_aarch64.whl.

File metadata

File hashes

Hashes for zenfmt-0.1.0-py3-none-manylinux_2_17_aarch64.whl
Algorithm Hash digest
SHA256 e9a0515841023b3cc673c1264074aa99343bd6a74d68fb27ed5dbf2d42c08c9d
MD5 c3c90109b1cd966bf7b4019ada57bab9
BLAKE2b-256 5145660d7f931bd01bd15703bc4b8141c1490af2c1e479755490d38c6ddd8fc8

See more details on using hashes here.

File details

Details for the file zenfmt-0.1.0-py3-none-macosx_12_0_x86_64.whl.

File metadata

File hashes

Hashes for zenfmt-0.1.0-py3-none-macosx_12_0_x86_64.whl
Algorithm Hash digest
SHA256 ef1ed24a052ca09d7d8028fe524d6bbc2282eb6d007938b3f1990f17f3bfebff
MD5 598bc575659eabbfdecaf8f7c1c9e68a
BLAKE2b-256 03e764a61d411e5e7b5f9bfe09380e1ea97c909ef88222c35094589d84d8127b

See more details on using hashes here.

File details

Details for the file zenfmt-0.1.0-py3-none-macosx_12_0_arm64.whl.

File metadata

File hashes

Hashes for zenfmt-0.1.0-py3-none-macosx_12_0_arm64.whl
Algorithm Hash digest
SHA256 3a3088d80b1bb90ec078c18aeaddb02a63bc0898106c48d25b4a5d80da89b9ff
MD5 dfcaa22e5cc4e879d6424044556fdfec
BLAKE2b-256 1af5d4528540560fec24ac4659f5c73bb98479f49ec301eb61cca0df177b6aee

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page