brotli-rs
Python bindings for Dropbox's safe-Rust brotli crate.
The C implementation is a security liability and
is not regularly released; this package remedies that by providing a memory-safe alternative.
It is a drop-in replacement for the Brotli package.
How to use
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__.
Compressed bytes are not promised to be byte-identical to Google's encoder. They are Brotli-compatible streams, tested in both directions against whatever the most recent Google encoder produces/consumers.
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.
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 the provenance of imported and adapted upstream tests.
This package was built with heavy use of LLMs. Trust in its correctness is derived from the circa 500 tests, which are a combination of upstream tests and new tests for the Python API. Also: the actual interface surface is small enough to be manually reviewed, and the underlying Rust crate is well-tested and actively maintained.
Metadata
Release files for brotli-rs 9.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| brotli_rs-9.1.1.tar.gz | 1.7 MB | With provenance | Details for brotli_rs-9.1.1.tar.gz |
Built distributions (wheels)
Total release size: 9.7 MB
Release files / brotli_rs-9.1.1.tar.gz
| Download URL | brotli_rs-9.1.1.tar.gz |
|---|---|
| Size | 1.7 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d756d764decf4d86870a3fd5df32c401ddb49633a27c7ef60500b6e0dda97391
|
|
BLAKE2b-256 checksum How to use checksums |
2d55bc321511ed42874ded0ae1d00c4bce9f663f524b555ae8f5b8ea6b65df29
|
| 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 27, 2026.
Transparency logRelease files / brotli_rs-9.1.1-cp311-abi3-win_arm64.whl
| Download URL | brotli_rs-9.1.1-cp311-abi3-win_arm64.whl |
|---|---|
| Size | 842.7 kB |
| Tags | CPython 3.11 Windows ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
9c7aa7277a60454333e7ecb54d48de20d22b955c49fb10e2dfa934ca053abbbb
|
|
BLAKE2b-256 checksum How to use checksums |
3806bb448e886bfa4bdd4f0d56270c6f16ebf148fd0531db3158739f12f85ade
|
| 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 27, 2026.
Transparency logRelease files / brotli_rs-9.1.1-cp311-abi3-win_amd64.whl
| Download URL | brotli_rs-9.1.1-cp311-abi3-win_amd64.whl |
|---|---|
| Size | 850.8 kB |
| Tags | CPython 3.11 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
0df4dba5e59bd15f8a3e4e989ea4b76d3731764cc29c04e03e28252f3f36f5b9
|
|
BLAKE2b-256 checksum How to use checksums |
f8a9843c0f904a639d023f0fee9161ab85e3c1664fdd1db55134c31656c96b2d
|
| 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 27, 2026.
Transparency logRelease files / brotli_rs-9.1.1-cp311-abi3-musllinux_1_2_x86_64.whl
| Download URL | brotli_rs-9.1.1-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 |
54e3926c6935668f4b311c56f2c4403ff8e2305c2b506ea1c9063a363b99fa97
|
|
BLAKE2b-256 checksum How to use checksums |
71f65b8d54c4a51e0eaf5e0560e32356e4c11c57a914afbbb04810bdd9af778e
|
| 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 27, 2026.
Transparency logRelease files / brotli_rs-9.1.1-cp311-abi3-musllinux_1_2_aarch64.whl
| Download URL | brotli_rs-9.1.1-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 |
3d57f9ddf9f87e7166d24fd5772c1dc9b1c72b4b4187b4d193986be2cab89cca
|
|
BLAKE2b-256 checksum How to use checksums |
4164f3abe168e837ef22fe56c9334a3dd1ff33068bf4c77fddd1e2e016ae575d
|
| 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 27, 2026.
Transparency logRelease files / brotli_rs-9.1.1-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | brotli_rs-9.1.1-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 1.0 MB |
| Tags | CPython 3.11 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
ac9058fc4a01d6bc7ea10756d351a78d2080f48f0eb526dea6d9ad98fdc44154
|
|
BLAKE2b-256 checksum How to use checksums |
56198e8591180d6a94b638df522ff3fbbf5ec36340c9d45d92dd69af721a58b3
|
| 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 27, 2026.
Transparency logRelease files / brotli_rs-9.1.1-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | brotli_rs-9.1.1-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 1.0 MB |
| Tags | CPython 3.11 Linux glibc 2.17+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
744d10d8fabf6eb38856d6d9f220db0e5ffad10b7857846f85b1fdc7e72f35a3
|
|
BLAKE2b-256 checksum How to use checksums |
01303c05e2efc98d7e8a670f4fe562890267b501c487665fa14103a5e4a5c576
|
| 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 27, 2026.
Transparency logRelease files / brotli_rs-9.1.1-cp311-abi3-macosx_11_0_arm64.whl
| Download URL | brotli_rs-9.1.1-cp311-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 969.8 kB |
| Tags | CPython 3.11 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
39ebb25a42563df3b0bfebfb81840479734cf225d59a390feeece28149297169
|
|
BLAKE2b-256 checksum How to use checksums |
58a6e49e8b7cecd5713aa46c9c946a571bf90d02703c4c013af50797159cc2c6
|
| 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 27, 2026.
Transparency logRelease files / brotli_rs-9.1.1-cp311-abi3-macosx_10_12_x86_64.whl
| Download URL | brotli_rs-9.1.1-cp311-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 965.2 kB |
| Tags | CPython 3.11 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
c95d5a98756d7f8bea6589774a140d9cf3457959ca0fc7f03b176dcc53a0fd8c
|
|
BLAKE2b-256 checksum How to use checksums |
b46b080526556fde3e705e0dc61db047dcf697313c7a0c90bf6571a5ab726387
|
| 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 27, 2026.
Transparency logSecurity for brotli-rs 9.1.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.
Full provenance
All 9 files in this release have been uploaded with provenance metadata.
Attestation for brotli_rs-9.1.1.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 27, 2026.
Transparency logA 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.