Skip to main content

brotli-rs

Python bindings for Dropbox's safe-Rust brotli crate.

The public API follows the Brotli Python package where that can be done without inheriting its C extension. The distribution and import names are both brotli-rs / brotli_rs, deliberately avoiding a collision with the existing brotli module.

import brotli_rs as brotli

compressed = brotli.compress(b"hello")
assert brotli.decompress(compressed) == b"hello"

Streaming compression and decompression are available through Compressor and Decompressor. Decompressor.process() supports a strict output_buffer_limit, and both streaming and one-shot decompression accept an optional max_output limit.

decoder = brotli.Decompressor(max_output=16 * 1024 * 1024)
parts = []
for compressed_chunk in source:
    while not decoder.is_finished() and not decoder.can_accept_more_data():
        parts.append(decoder.process(b"", output_buffer_limit=64 * 1024))
    parts.append(decoder.process(compressed_chunk, output_buffer_limit=64 * 1024))
while not decoder.is_finished() and not decoder.can_accept_more_data():
    parts.append(decoder.process(b"", output_buffer_limit=64 * 1024))
if not decoder.is_finished():
    raise brotli.error("incomplete stream")

The compatibility surface consists of compress, decompress, Compressor.process() / .flush() / .finish(), Decompressor.process() / .can_accept_more_data() / .is_finished(), the three MODE_* constants, error, version, and __version__. Contiguous buffer-protocol inputs are accepted. version is a string alias of __version__, as it is in the current Brotli package.

Compressed bytes are not promised to be byte-identical to Google's encoder. They are Brotli-compatible streams, tested in both directions against Google Brotli 1.2.1. Exception text, subclassing, pickling, non-contiguous buffers, and private implementation names are outside the compatibility contract.

The base package version tracks the Rust brotli crate exactly. Python-binding-only fixes use PEP 440 post releases, such as 9.0.0.post1, while still pinning brotli = 9.0.0.

Why?

What do you think is more secure? World class engineers working at one of the world's largest tech companies trying to juggle chainsaws in their spare time, or an entirely vibe-coded wrapper in a memory-safe language with a Rust crate on the inside?

If you bet on the latter, you've come to the right place.

Development

Install Rust and Python 3.11 or newer, then:

python -m venv .venv
. .venv/bin/activate
python -m pip install maturin
maturin develop --extras=test
pytest

See tests/upstream/README.md for the provenance of imported and adapted upstream tests.

Metadata

Release files for brotli-rs 9.0.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 brotli-rs 9.0.0
File Size Uploaded Provenance Actions
brotli_rs-9.0.0.tar.gz 1.7 MB With provenance Details for brotli_rs-9.0.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for brotli-rs 9.0.0
File Actions
brotli_rs-9.0.0-cp311-abi3-win_arm64.whl CPython 3.11 abi3 Windows ARM64 Details for brotli_rs-9.0.0-cp311-abi3-win_arm64.whl
brotli_rs-9.0.0-cp311-abi3-win_amd64.whl CPython 3.11 abi3 Windows x86-64 Details for brotli_rs-9.0.0-cp311-abi3-win_amd64.whl
brotli_rs-9.0.0-cp311-abi3-musllinux_1_2_x86_64.whl CPython 3.11 abi3 Linux musl 1.2+ x86-64 Details for brotli_rs-9.0.0-cp311-abi3-musllinux_1_2_x86_64.whl
brotli_rs-9.0.0-cp311-abi3-musllinux_1_2_aarch64.whl CPython 3.11 abi3 Linux musl 1.2+ ARM64 Details for brotli_rs-9.0.0-cp311-abi3-musllinux_1_2_aarch64.whl
brotli_rs-9.0.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.11 abi3 Linux glibc 2.17+ x86-64 Details for brotli_rs-9.0.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
brotli_rs-9.0.0-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.11 abi3 Linux glibc 2.17+ ARM64 Details for brotli_rs-9.0.0-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
brotli_rs-9.0.0-cp311-abi3-macosx_11_0_arm64.whl CPython 3.11 abi3 macOS 11.0+ ARM64 Details for brotli_rs-9.0.0-cp311-abi3-macosx_11_0_arm64.whl
brotli_rs-9.0.0-cp311-abi3-macosx_10_12_x86_64.whl CPython 3.11 abi3 macOS 10.12+ x86-64 Details for brotli_rs-9.0.0-cp311-abi3-macosx_10_12_x86_64.whl

Total release size: 9.6 MB

Release files / brotli_rs-9.0.0.tar.gz

Download URL brotli_rs-9.0.0.tar.gz
Size 1.7 MB
Tags Source
SHA-256 checksum
How to use checksums
0848a9b61e9cebed20e4d355efd762f1cd8efcc240096427fbf3d46a8f748cad
BLAKE2b-256 checksum
How to use checksums
bc8053a5e170af49ed87ec712b097a12264b222eaad7b636c227fd0dba79296a
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 Oct 24, 2026.

Transparency log

Release files / brotli_rs-9.0.0-cp311-abi3-win_arm64.whl

Download URL brotli_rs-9.0.0-cp311-abi3-win_arm64.whl
Size 835.4 kB
Tags CPython 3.11 Windows ARM64 abi3
SHA-256 checksum
How to use checksums
f40fac0fc13866304605a23c3a44114d6504e89486db0b6a4c1f8f15018623ca
BLAKE2b-256 checksum
How to use checksums
65ac9dda926f99f7e5c8783e4f59bfaf6c38f4f38ac199bfeafdbb1ce24547c1
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 Oct 24, 2026.

Transparency log

Release files / brotli_rs-9.0.0-cp311-abi3-win_amd64.whl

Download URL brotli_rs-9.0.0-cp311-abi3-win_amd64.whl
Size 841.0 kB
Tags CPython 3.11 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
3d895f283c0051627ad8994e8f28ae2687c649c3acc876c286990cb69bfc4416
BLAKE2b-256 checksum
How to use checksums
0c6a9432b9877d2ed371e8c751f3955af89d6f422bd8a298bec4ea021f2c37e5
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 Oct 24, 2026.

Transparency log

Release files / brotli_rs-9.0.0-cp311-abi3-musllinux_1_2_x86_64.whl

Download URL brotli_rs-9.0.0-cp311-abi3-musllinux_1_2_x86_64.whl
Size 1.2 MB
Tags CPython 3.11 Linux musl 1.2+ x86-64 abi3
SHA-256 checksum
How to use checksums
d5c77ae635b02eeb7d89e9f06e02337e7d397f48d71df8ce5d543b3a9a0ad466
BLAKE2b-256 checksum
How to use checksums
9867fea4dea0690446b9d20788f89a65ee0c448d1f681ef1f6d59a31eff680bd
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 Oct 24, 2026.

Transparency log

Release files / brotli_rs-9.0.0-cp311-abi3-musllinux_1_2_aarch64.whl

Download URL brotli_rs-9.0.0-cp311-abi3-musllinux_1_2_aarch64.whl
Size 1.2 MB
Tags CPython 3.11 Linux musl 1.2+ ARM64 abi3
SHA-256 checksum
How to use checksums
00109d8a2eac5db00ccfd0cd0493b9ba83b6332aff72febea2a537ad2a554cac
BLAKE2b-256 checksum
How to use checksums
4c79045ab17fbeac4cad4e5fd82fa93ce69e3e065d60a085b81c2846c23b87ab
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 Oct 24, 2026.

Transparency log

Release files / brotli_rs-9.0.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL brotli_rs-9.0.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 995.3 kB
Tags CPython 3.11 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
c27ee18e98d8d1271fc4e0e6b7e7853b967e44ba4a4c01905118e07713bacf77
BLAKE2b-256 checksum
How to use checksums
18e0a7b2bb021c3997f23e23a55a7314ff010d6d68dbb4df61b13a1531f20e16
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 Oct 24, 2026.

Transparency log

Release files / brotli_rs-9.0.0-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL brotli_rs-9.0.0-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 994.9 kB
Tags CPython 3.11 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
af9d8b527b62c38819e454d9832da19ce5ff830844c303d405117e57b32f9252
BLAKE2b-256 checksum
How to use checksums
1239adca7e80cb523b1fdc6a4194cb267fdf17ebbdc6bf059a6554004b0db18b
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 Oct 24, 2026.

Transparency log

Release files / brotli_rs-9.0.0-cp311-abi3-macosx_11_0_arm64.whl

Download URL brotli_rs-9.0.0-cp311-abi3-macosx_11_0_arm64.whl
Size 950.8 kB
Tags CPython 3.11 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
747d75e931f0ea4feb032b3b365342bab1ce2dad73c2ee2a939dae77cf9a1879
BLAKE2b-256 checksum
How to use checksums
c970bf0b40146199ad25106427aa531cc56f7d7a07b02cd852c85f7564711577
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 Oct 24, 2026.

Transparency log

Release files / brotli_rs-9.0.0-cp311-abi3-macosx_10_12_x86_64.whl

Download URL brotli_rs-9.0.0-cp311-abi3-macosx_10_12_x86_64.whl
Size 943.0 kB
Tags CPython 3.11 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
825e1e811e1ee54311bec43a7e7a6730dcc3b55432d0fc3513f8ead5a0e2a3e8
BLAKE2b-256 checksum
How to use checksums
7cc2168a4b2a712cf5c0706ca57906260d6366b6d27bf4abd99e6c3363425d86
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 Oct 24, 2026.

Transparency log

Security for brotli-rs 9.0.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 9 files in this release have been uploaded with provenance metadata.

Select from 9 files

Attestation for brotli_rs-9.0.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 Oct 24, 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.

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