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.

Release files for zenfmt 0.3.6

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

Source distribution (sdist)

Source distribution for zenfmt 0.3.6
File Size Uploaded
zenfmt-0.3.6.tar.gz 474.4 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for zenfmt 0.3.6
File
zenfmt-0.3.6-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details
zenfmt-0.3.6-py3-none-musllinux_1_2_x86_64.whl Python 3 none Linux musl 1.2+ x86-64 Details
zenfmt-0.3.6-py3-none-musllinux_1_2_aarch64.whl Python 3 none Linux musl 1.2+ ARM64 Details
zenfmt-0.3.6-py3-none-manylinux_2_17_x86_64.whl Python 3 none Linux glibc 2.17+ x86-64 Details
zenfmt-0.3.6-py3-none-manylinux_2_17_aarch64.whl Python 3 none Linux glibc 2.17+ ARM64 Details
zenfmt-0.3.6-py3-none-macosx_12_0_x86_64.whl Python 3 none macOS 12.0+ x86-64 Details
zenfmt-0.3.6-py3-none-macosx_12_0_arm64.whl Python 3 none macOS 12.0+ ARM64 Details

Total release size: 15.6 MB

Release files / zenfmt-0.3.6.tar.gz

Download URL zenfmt-0.3.6.tar.gz
Size 474.4 kB
Tags Source
SHA-256 checksum
How to use checksums
24ddc30825a23d23716bb8ff7a4c1727c5b1b6cd429f9d3de890c45c207b8de4
BLAKE2b-256 checksum
How to use checksums
cc0db9bd84c1d3474ee8f9794fb504feebe5c863980e3b0e2b1a5a69667e101b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / zenfmt-0.3.6-py3-none-win_amd64.whl

Download URL zenfmt-0.3.6-py3-none-win_amd64.whl
Size 1.0 MB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
c127cc6d574c897d9edbff7bc39111d516551d6492079532c6b22d12275243ba
BLAKE2b-256 checksum
How to use checksums
0b9689cf69a33b539363f85464e27e5031fe54debe75e873fc6c92f305b6768b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / zenfmt-0.3.6-py3-none-musllinux_1_2_x86_64.whl

Download URL zenfmt-0.3.6-py3-none-musllinux_1_2_x86_64.whl
Size 3.1 MB
Tags Linux musl 1.2+ x86-64 Python 3
SHA-256 checksum
How to use checksums
d1bd508eceb335db8b0ee2717837a3c30bf725b6fa5db5f5c0905c6af4b4aa6e
BLAKE2b-256 checksum
How to use checksums
89ec4a3682316caac138c956f5947bc769e6602504c3ca5f196125bb357706cc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / zenfmt-0.3.6-py3-none-musllinux_1_2_aarch64.whl

Download URL zenfmt-0.3.6-py3-none-musllinux_1_2_aarch64.whl
Size 2.9 MB
Tags Linux musl 1.2+ ARM64 Python 3
SHA-256 checksum
How to use checksums
1201c293d9f40ae79e07c0472fbb7c2c29febcc405e9d9431469a4640ea599b0
BLAKE2b-256 checksum
How to use checksums
3819955d092ac60e0e44481f1cb1435fb5ed46caa6b7870a1b6e74a68a4555a3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / zenfmt-0.3.6-py3-none-manylinux_2_17_x86_64.whl

Download URL zenfmt-0.3.6-py3-none-manylinux_2_17_x86_64.whl
Size 3.1 MB
Tags Linux glibc 2.17+ x86-64 Python 3
SHA-256 checksum
How to use checksums
487b6f212be63bbd38828e4b9f2385bc6cf13f718bded25a9c1377241b3055bb
BLAKE2b-256 checksum
How to use checksums
970e6d824328d2fd811741c96a7293561d6201c23c6adcd4c0a8a32844856d19
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / zenfmt-0.3.6-py3-none-manylinux_2_17_aarch64.whl

Download URL zenfmt-0.3.6-py3-none-manylinux_2_17_aarch64.whl
Size 2.9 MB
Tags Linux glibc 2.17+ ARM64 Python 3
SHA-256 checksum
How to use checksums
fb9087ea4f0811f0abdc625af07a584bf3da04fe42be113635569f1c9edb838f
BLAKE2b-256 checksum
How to use checksums
dba62d34c577b554b6ede7118d0db48a2810580f263b93269923cc0f9821138f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / zenfmt-0.3.6-py3-none-macosx_12_0_x86_64.whl

Download URL zenfmt-0.3.6-py3-none-macosx_12_0_x86_64.whl
Size 1.0 MB
Tags Python 3 macOS 12.0+ x86-64
SHA-256 checksum
How to use checksums
8ba9afe94ebb2c2d8a26a720cc8a8ddb9510f473dad8d033943fe507f2c5d2eb
BLAKE2b-256 checksum
How to use checksums
e3523fd263d85046d8d17ea66006cd3bf374f54fe1241ecec6c615746ba7d8cb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / zenfmt-0.3.6-py3-none-macosx_12_0_arm64.whl

Download URL zenfmt-0.3.6-py3-none-macosx_12_0_arm64.whl
Size 953.9 kB
Tags Python 3 macOS 12.0+ ARM64
SHA-256 checksum
How to use checksums
de9955663227ed97c6d440532526037bce6c2053b22abe0647fb3e68d4298148
BLAKE2b-256 checksum
How to use checksums
bc9035c47daf8edf8bdc6e1798e46e3e385bac7c93c8289c6cc4a192773f5a10
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release history Release notifications | RSS feed

0.3.7

8 release files

This release

0.3.6 This release

8 release files

0.3.5

8 release files

0.3.3

8 release files

0.3.2

8 release files

0.3.1

8 release files

0.3.0

8 release files

0.2.0

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