Skip to main content

anytomd

Any document to clean Markdown — a thin, typed Python binding of anytomd-rs, the pure-Rust document intelligence engine. PyO3 extension module, abi3, zero Python runtime dependencies.

uv add anytomd          # or: pip install anytomd
from anytomd import convert_file

report = convert_file("document.docx")
print(report.markdown)      # headings, tables, lists, links, embedded images
print(report.plain_text)    # same content, no markers
print(report.title)         # first heading, if any

API

convert_file(path, **options) Convert a document by path; format autodetected from magic bytes and extension.
convert_bytes(data, format, **options) Convert raw bytes with an explicit format ("csv", "docx", …).
await convert_file_async(path, **options) Async variant; concurrent image description.
await convert_bytes_async(data, format, **options) Async variant over bytes.
detect_format(path, data) Format string the engine would choose, or None.
detect_zip_format(data) Concrete OOXML type behind ZIP magic ("docx", "pptx", "xlsx", or None).

Options (keyword-only, on all four conversions)

extract_images, extract_comments, strict, max_input_bytes, max_total_image_bytes, max_uncompressed_zip_bytes, and image_describer / async_image_describer on the sync/async variants respectively. The engine's own defaults apply unless overridden.

The engine collects image bytes only when extract_images=True or a describer is attached. For the async describers pass extract_images=True — the gate lives in the Rust crate.

Result

ConversionResult exposes markdown: str, plain_text: str, title: str | None, images: list[tuple[str, bytes]] and warnings: list[ConversionWarning]; each warning carries code ("skipped_element" | "unsupported_feature" | "resource_limit_reached" | "malformed_segment"), message and location.

Image description

Any callable f(image_bytes, mime_type, prompt) -> str (sync) or an async def of the same shape (async) plugs into image_describer / async_image_describer. Failures degrade to skipped_element warnings — never abort — unless strict=True. Descriptions run off the GIL; the async bridge resolves all images concurrently through the running asyncio loop.

Built-in providers ship with the crate: GeminiDescriber and AsyncGeminiDescriber (API key argument or GEMINI_API_KEY), and work with any OpenAI-compatible gateway through your own callable.

Errors

ConvertError is the base; UnsupportedFormatError, FormatNotSupportedError, InputTooLargeError (with .size and .limit), MalformedDocumentError, ImageDescriptionError, ZipError, XmlError, SpreadsheetError and Utf8Error refine it. Filesystem failures raise OSError.

Formats

DOCX, PPTX, XLSX/XLS, HTML, CSV, Jupyter notebooks, JSON, XML, images (PNG, JPEG, GIF, WebP, BMP, TIFF, SVG, HEIC, AVIF), source code (90+ languages) and plain text. PDF is intentionally refused — LLMs read it natively.

Development

make build         # maturin develop (debug)
make test          # unit suite + 100% coverage gate
make stress        # threads, loops, volume, hypothesis fuzz
make integration   # real LLM describer (defaults to Alibaba token-plan, see tests/conftest.py)
make suite         # everything, one coverage gate
make samples       # regenerate synthetic fixtures
make samples-real  # download real-world fixtures
make dist          # release wheels + sdist

License

MIT for the binding. Wheels embed anytomd-rs under Apache-2.0.

Metadata

Release files for anytomd 1.3.1

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

Source distribution (sdist)

Source distribution for anytomd 1.3.1
File Size Uploaded Provenance
anytomd-1.3.1.tar.gz 25.0 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for anytomd 1.3.1
File Interpreter ABI Platform
anytomd-1.3.1-cp314-abi3-manylinux_2_34_x86_64.whl CPython 3.14 abi3 Linux glibc 2.34+ x86-64 Details

Total release size: 2.5 MB

Release files / anytomd-1.3.1.tar.gz

Download URL anytomd-1.3.1.tar.gz
Size 25.0 kB
Tags Source
SHA-256 checksum
How to use checksums
d200c12cf91a6f70080ace2e019fd22f75296b14f92fbb0225f784a1aa802f0b
BLAKE2b-256 checksum
How to use checksums
63448c78042d0224a849372b04be4fa0bf1c4aa4afb9de4ebbb77391e6fd8321
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

Release files / anytomd-1.3.1-cp314-abi3-manylinux_2_34_x86_64.whl

Download URL anytomd-1.3.1-cp314-abi3-manylinux_2_34_x86_64.whl
Size 2.5 MB
Tags CPython 3.14 Linux glibc 2.34+ x86-64 abi3
SHA-256 checksum
How to use checksums
4146198b0333b325f8dba05b252a7da17ad7a11beb40577f8d8cab3b874d61ee
BLAKE2b-256 checksum
How to use checksums
7cb5730a9cae5d9406eee728604027dd373874537ebd6f08398b268cfdda314a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

Security for anytomd 1.3.1

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

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