Repository navigation
Python bindings for whiff. Point it at a file or at bytes and get one whiff/1 report: what the file is, where it came from, which rights apply, its hashes and risk signals, and a compact view of its content.
This release wraps crates.io whiff 0.8.0 with the common feature set. It does not reimplement extractors. The PyPI name whiff already belongs to an unrelated project, so the distribution is whiff-python. The import name is whiff.
Highlights
whiff.extracttakes a path,bytes, or a binary file object and returns a dict. Problems inside a file stay indiagnostics. A path that cannot be inspected raisesWhiffError.NotFoundErroris also aFileNotFoundError;AccessErroris also aPermissionError.whiff.llmreturns upstreamReport::llm_view(1..100000 tokens, default 800).whiff.extract_manykeeps input order.on_error="collect"yields(path, report)or(path, error).on_error="halt"raises, anderr.details["partial"]holds the pairs finished before the failure.whiff.Engineholds native options and can be shared across threads. A process-wide semaphore (default 8 slots, 60s wait) bounds native calls. A waiter that times out raisesOverloadedError.- Python
ExtractorandAnalyzerclasses patch the report after native extraction, infallback,augment, oroverridemode. They do not enter the Rust registry, they do not run for embedded children, andllmdoes not run them.privacy="strict"scrubs plugin patches. Secrets are redacted either way. stage="local"copies a regular file into a private scratch directory before taking a native slot, for a slow or network filesystem. The report still names the original path.
Install
pip install whiff-python==0.1.0import whiff
report = whiff.extract("invoice.pdf")
report["identification"]["format"] # "pdf"
view = whiff.llm("contract.pdf", tokens=800)Python 3.11 or later. Wheels use PyO3's stable ABI (abi3-py311), so one wheel covers 3.11 and newer: Linux x86_64 and aarch64, macOS x86_64 and arm64, Windows x64.
Published wheels enable common only: text, documents, images, audio and video, archives, executables, certificates, databases, source code, and the rest of the default collection. geo, science, data, cad, forensics, and games are a source build (maturin develop --features full). There is no CLI in this package.
Limitations
extractofbytescopies the buffer once. A file object is read up to the read cap. There is no streaming reader.- A native
file_timeoutcan leave a Rust worker running after the call returns. - IO error messages include the full path.
https://github.com/SinAnima/whiff-python · https://pypi.org/project/whiff-python/ · upstream https://github.com/SinAnima/whiff