Skip to main content

whiff

Python bindings for whiff. Point it at a file or at bytes and it returns one whiff/1 report: format, hashes, security and rights signals, content, and format-specific metadata.

Identification and extraction run in the Rust crate (0.8.0, the common feature set). Python extractors and analyzers can add fields afterwards. They do not run inside native extraction, and they do not run for embedded children.

import whiff

report = whiff.extract("invoice.pdf")
report["identification"]["format"]  # "pdf"

report = whiff.extract(data, name="invoice.pdf", hashes=["sha256"])
view = whiff.llm("contract.pdf", tokens=800)

Empty optional fields are omitted. The vendored schema is whiff.schema().

Install

Import the package as whiff. The PyPI project whiff already belongs to an unrelated library, so this distribution is named whiff-python. A GitHub release tagged with the version in pyproject.toml (an optional v prefix is fine) publishes the wheels. From a checkout, with Rust 1.89 or later:

maturin develop

That builds the common formats. A source build of every collection is:

maturin develop --features full

geo, science, data, cad, forensics, and games are the individual cargo features. Wheels are built with common only.

Extract

extract accepts a path, bytes, or a binary file object. A file object is read up to max_read_bytes and then treated as bytes. name (or filename, not both) drives extension detection for in-memory input.

Corrupt or partial files still return a report. Problems inside the file are listed in diagnostics. The call raises WhiffError when the path cannot be inspected or an option is invalid:

try:
    report = whiff.extract(path)
except whiff.NotFoundError:
    ...
except whiff.AccessError:
    ...
except whiff.InvalidOptionError as err:
    print(err.message)

NotFoundError is also a FileNotFoundError. AccessError is also a PermissionError. IO messages include the full path.

llm returns upstream Report::llm_view. Python plugins do not run for it.

results = whiff.extract_many(
    paths,
    max_concurrency=4,
    timeout=300_000,
    profile="minimal",
    hashes="none",
)

Results keep input order. With on_error="collect" (the default) each item is (path, report) or (path, error). With on_error="halt" the first error is raised and err.details["partial"] holds the pairs completed before it. timeout is per path, in milliseconds. A timeout does not stop native work that has already started.

An Engine holds native options and is safe to share across threads:

engine = whiff.Engine(profile="minimal", hashes="none")
engine.extract(path)

Native calls take a process-wide slot (default 8). A caller that waits longer than native_wait_ms (default 60000) raises OverloadedError. Change the limits with whiff.configure(native_max_concurrency=4, native_wait_ms=10_000).

stage="local" copies a regular file into a private scratch directory before taking a slot, for slow or network filesystems. The copy is removed afterwards. The report still describes the original path. Times are second precision, and fields Python does not read (birth time, allocated size, owner names, ACLs, extended attributes) are omitted, with a diagnostics.warnings entry. Files larger than scratch_max_bytes (default 1 GiB) are rejected.

Options

An option a function does not use is rejected.

Option Values Default
profile minimal, standard, full, llm standard
hashes all, none, or a list of sha256 / blake3 all
privacy strict, off strict
only / skip extractor ids or groups none
format format id to force detect
provenance record which extractor set each field False
limits dict of native limits; see below profile limits
stage never, local never
name / filename / mime strings (bytes and file objects) none
tokens 1..100000 800 (llm only)
mode fallback, augment, override fallback
extractors / analyzers plugin classes or instances none
strict plugin failure raises False
plugin_timeout_ms 1..600000 5000
override_fields dotted paths, for example ["content.title"] []
max_concurrency / on_error / timeout extract_many 4 / collect / 300000

limits keys: max_read_bytes and max_decompressed_bytes (1..4 GiB), hash_max_bytes (0..4 GiB), max_parse_bytes (0..256 MiB), max_text_bytes (0..64 MiB), max_depth (0..8), max_children (0..500), file_timeout_ms and extractor_timeout_ms (1..600000).

privacy="strict" reduces personal data in native structured fields to counts and scrubs plugin patches. Upstream redacts secrets either way. privacy="off" leaves plugin patches unchanged.

Plugins

class Trade(whiff.Extractor):
    id = "myapp.trade"
    version = 1

    def supports(self, source, report) -> bool:
        return source.extension == ".trade"

    def extract(self, source, report) -> dict:
        return {"format": {"myapp.trade": {"trade_id": "T-1001"}}}


report = whiff.extract("positions/2026-10-28.trade", extractors=[Trade])

An analyzer subclasses whiff.Analyzer and implements analyze(report, source). Analyzers run after extractors. Their patches always merge in augment mode.

Mode When an extractor runs Existing native values
fallback native extraction did not cover a readable file kept, except content.*
augment supports returns true kept
override supports returns true replaced for paths in override_fields

whiff, integrity, and embedded cannot be patched. diagnostics accepts only extra warnings. security.risks are appended with source set to python:<id>. metadata and format keys are namespaces. One plugin cannot replace a value another plugin wrote unless that path is declared.

A failed plugin is recorded in diagnostics.extractors with status error, and the call still returns the report. With strict=True the call raises. Plugins run on a worker thread. They are not a security boundary.

whiff.merge applies the same rules to a patch dict.

Development

cargo test
cargo clippy --all-targets -- -D warnings
maturin develop
ruff check src tests
pytest

Golden reports are compared with probes/rust_extract, which links the same whiff 0.8.0 crate. Design notes: docs/adr/0001-baseline.md.

Limitations

  • extract of bytes copies the buffer once into native memory.
  • There is no streaming reader. A file object is read up to the read cap.
  • Python callbacks do not run for embedded children, and llm does not run them.
  • stage="local" copies the whole file first.
  • A native file_timeout can leave a Rust worker running after the call returns.
  • IO error messages include the full path.

License

MIT. Upstream whiff is also MIT.

Metadata

Release files for whiff-python 0.1.0

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

Source distribution (sdist)

Source distribution for whiff-python 0.1.0
File Size Uploaded Provenance Actions
whiff_python-0.1.0.tar.gz 50.7 kB With provenance Details for whiff_python-0.1.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for whiff-python 0.1.0
File Actions
whiff_python-0.1.0-cp311-abi3-win_amd64.whl CPython 3.11 abi3 Windows x86-64 Details for whiff_python-0.1.0-cp311-abi3-win_amd64.whl
whiff_python-0.1.0-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.11 abi3 Linux glibc 2.17+ x86-64 Details for whiff_python-0.1.0-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
whiff_python-0.1.0-cp311-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl CPython 3.11 abi3 Linux glibc 2.17+ ARM64 Details for whiff_python-0.1.0-cp311-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
whiff_python-0.1.0-cp311-abi3-macosx_11_0_arm64.whl CPython 3.11 abi3 macOS 11.0+ ARM64 Details for whiff_python-0.1.0-cp311-abi3-macosx_11_0_arm64.whl
whiff_python-0.1.0-cp311-abi3-macosx_10_12_x86_64.whl CPython 3.11 abi3 macOS 10.12+ x86-64 Details for whiff_python-0.1.0-cp311-abi3-macosx_10_12_x86_64.whl

Total release size: 52.6 MB

Release files / whiff_python-0.1.0.tar.gz

Download URL whiff_python-0.1.0.tar.gz
Size 50.7 kB
Tags Source
SHA-256 checksum
How to use checksums
0e149ede4acdbe3cebff91548a73c8f172fd07ebad05df8b68b90376866b892b
BLAKE2b-256 checksum
How to use checksums
41549e6b3fdd736b3177c8fb4b827e923479ef171d0556becdc731684fdfca33
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 14, 2026.

Transparency log

Release files / whiff_python-0.1.0-cp311-abi3-win_amd64.whl

Download URL whiff_python-0.1.0-cp311-abi3-win_amd64.whl
Size 10.2 MB
Tags CPython 3.11 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
04ec621f4abc9b47fb5c7fc840e787a8f40d6f51a804061ae9fb25e22bdcb6a9
BLAKE2b-256 checksum
How to use checksums
bc153f35d5e8f8effc69e7d620d8d071d755d9fa39cf29df2a94ef3372543296
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 14, 2026.

Transparency log

Release files / whiff_python-0.1.0-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL whiff_python-0.1.0-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 11.0 MB
Tags CPython 3.11 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
c16c57cb45a18a3b59094aff2c941516317041695e8b92f51deac1903c90be55
BLAKE2b-256 checksum
How to use checksums
797826623b88d9f4c3693112d8af904430b5824d17d2eb8b763d92718f50bf05
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 14, 2026.

Transparency log

Release files / whiff_python-0.1.0-cp311-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL whiff_python-0.1.0-cp311-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 11.0 MB
Tags CPython 3.11 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
733787a62f203e37f9a7d495f630a38f28015b3cd9e9f4b9abb0c10f54e0e392
BLAKE2b-256 checksum
How to use checksums
198cb4da9a631b4551b88ade0981f6cdb361a8f5ee332b7b7abf7c3a09d005bf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 14, 2026.

Transparency log

Release files / whiff_python-0.1.0-cp311-abi3-macosx_11_0_arm64.whl

Download URL whiff_python-0.1.0-cp311-abi3-macosx_11_0_arm64.whl
Size 9.9 MB
Tags CPython 3.11 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
dcd4d993607750a150bd16d5a17914e6fa53494747ef7061ccef4502890f4751
BLAKE2b-256 checksum
How to use checksums
affe3a6db200bdd362bd3074cbf9e665b8503451b99cba5ba9031656642a9de9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 14, 2026.

Transparency log

Release files / whiff_python-0.1.0-cp311-abi3-macosx_10_12_x86_64.whl

Download URL whiff_python-0.1.0-cp311-abi3-macosx_10_12_x86_64.whl
Size 10.4 MB
Tags CPython 3.11 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
89d4ff9f20c5df84b9260dc210f2205bdc2c069296e547c2db72121ccef1cf01
BLAKE2b-256 checksum
How to use checksums
3b765d67d4f61e8d14604ac0e0ee10aed09ff1c89214fcbfed9041f87afcaa6f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 14, 2026.

Transparency log

Security for whiff-python 0.1.0

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.

Full provenance

All 6 files in this release have been uploaded with provenance metadata.

Select from 6 files

Attestation for whiff_python-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 14, 2026.

Transparency log

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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

6 release files Full provenance

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