Skip to main content

brotli-rs

brotli-rs logo

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. Also also: it's not the upstream C lib is free from LLM mistakes.

Metadata

Release files for brotli-rs 9.1.3.post2

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.1.3.post2
File Size Uploaded Provenance Actions
brotli_rs-9.1.3.post2.tar.gz 2.7 MB With provenance Details for brotli_rs-9.1.3.post2.tar.gz

Built distributions (wheels)

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

Total release size: 10.8 MB

Release files / brotli_rs-9.1.3.post2.tar.gz

Download URL brotli_rs-9.1.3.post2.tar.gz
Size 2.7 MB
Tags Source
SHA-256 checksum
How to use checksums
b6713ef9902ef13b725f2abe7e1eb082431c893f844ff97d938a43926236d5e4
BLAKE2b-256 checksum
How to use checksums
71bcde15600008819e2ba7d4e17d458ae68c3b02ffe960775eb144043f15cc7e
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 30, 2026.

Transparency log

Release files / brotli_rs-9.1.3.post2-cp311-abi3-win_arm64.whl

Download URL brotli_rs-9.1.3.post2-cp311-abi3-win_arm64.whl
Size 851.9 kB
Tags CPython 3.11 Windows ARM64 abi3
SHA-256 checksum
How to use checksums
01ff625d80bb245154a02318edb91a2d76c37e37d3feff1e6f0c3be5dc2a85d4
BLAKE2b-256 checksum
How to use checksums
b9197dad3521560bc6f7a3fe3baa0919fad5e91bb23f6399ccce216262159427
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 30, 2026.

Transparency log

Release files / brotli_rs-9.1.3.post2-cp311-abi3-win_amd64.whl

Download URL brotli_rs-9.1.3.post2-cp311-abi3-win_amd64.whl
Size 856.5 kB
Tags CPython 3.11 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
f28b61dddaed7d5a48c6bcfd1586323c48383f87ce17e79328e9d5658654f8b6
BLAKE2b-256 checksum
How to use checksums
cce5e2a470d6104ea360816cb6a2a6ffffe6a30c7fb8c08db780cbce5cee6ae1
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 30, 2026.

Transparency log

Release files / brotli_rs-9.1.3.post2-cp311-abi3-musllinux_1_2_x86_64.whl

Download URL brotli_rs-9.1.3.post2-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
0f437dbb49356bf55cbbe1ddae5a75d8f1d208be347785fd716035ae3624a4aa
BLAKE2b-256 checksum
How to use checksums
6de35f6b48a427037cd746ed2d601c4e006c4f0113375ea82bf549ddbfbf2419
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 30, 2026.

Transparency log

Release files / brotli_rs-9.1.3.post2-cp311-abi3-musllinux_1_2_aarch64.whl

Download URL brotli_rs-9.1.3.post2-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
be28f1e5f849ce3ece60c19b088db73c471e0d47f8b999bbeecff3b09b4ef1b9
BLAKE2b-256 checksum
How to use checksums
9e7eaa46fbd44b650ea6a9f981f94363330d59fa7e3ca1ad6b954fc336718dbb
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 30, 2026.

Transparency log

Release files / brotli_rs-9.1.3.post2-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL brotli_rs-9.1.3.post2-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_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
de9bc3999b77f638e4b26ac5c80c08f25ce2a0e8366d58aa69a60f31fc58a9e7
BLAKE2b-256 checksum
How to use checksums
45542f2b978aa1fb4cf29bfe907779b9bb136c6f52a14a99f26d8da185be356f
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 30, 2026.

Transparency log

Release files / brotli_rs-9.1.3.post2-cp311-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL brotli_rs-9.1.3.post2-cp311-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 1.0 MB
Tags CPython 3.11 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
5f617010df4a8a10894b37ef2e7182f561fc6a67857429a1cd90f8f8769a6331
BLAKE2b-256 checksum
How to use checksums
ff429fc8751c93d8e8b87c889df56f8675ec593c1a1dcbbc7e71dd51daffe4df
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 30, 2026.

Transparency log

Release files / brotli_rs-9.1.3.post2-cp311-abi3-macosx_11_0_arm64.whl

Download URL brotli_rs-9.1.3.post2-cp311-abi3-macosx_11_0_arm64.whl
Size 978.8 kB
Tags CPython 3.11 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
5b3a31b563908f8c96aa382a6be6c8f2fd73387f3e0b0806f338fb39511eff45
BLAKE2b-256 checksum
How to use checksums
a63b89692c9a892d4cffe50c02ff89093a6b9bc25d1bf57b7679c92657a2fe23
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 30, 2026.

Transparency log

Release files / brotli_rs-9.1.3.post2-cp311-abi3-macosx_10_12_x86_64.whl

Download URL brotli_rs-9.1.3.post2-cp311-abi3-macosx_10_12_x86_64.whl
Size 970.5 kB
Tags CPython 3.11 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
1610e142133d8f881a0a5f64983eafa337e04aa2ae7f30aa451dedf885f8ae30
BLAKE2b-256 checksum
How to use checksums
d6a6d17c46015d869c156991bb482046a223ffbbfc42e21a73788fd8c32ca678
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 30, 2026.

Transparency log

Security for brotli-rs 9.1.3.post2

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.1.3.post2.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 30, 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