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.1.post1

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.1.post1
File Size Uploaded Provenance Actions
brotli_rs-9.1.1.post1.tar.gz 1.8 MB With provenance Details for brotli_rs-9.1.1.post1.tar.gz

Built distributions (wheels)

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

Total release size: 9.9 MB

Release files / brotli_rs-9.1.1.post1.tar.gz

Download URL brotli_rs-9.1.1.post1.tar.gz
Size 1.8 MB
Tags Source
SHA-256 checksum
How to use checksums
fffd3b7745e2953414b40c3d4c7d360a7f80ef7f97168b79953ac7eaf9d8e971
BLAKE2b-256 checksum
How to use checksums
691b75399f7f8bccc620ca741783fd9608495471574877ef00f35b4e72ba3880
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 6, 2026.

Transparency log

Release files / brotli_rs-9.1.1.post1-cp311-abi3-win_arm64.whl

Download URL brotli_rs-9.1.1.post1-cp311-abi3-win_arm64.whl
Size 851.6 kB
Tags CPython 3.11 Windows ARM64 abi3
SHA-256 checksum
How to use checksums
31f363e89c7e8aeb43c1338a548901582293f1c85fb7742c046edb5f244fa696
BLAKE2b-256 checksum
How to use checksums
22a5130111c30ee2bda801843ba5f1199ccc15108a22c8f4bbb44750bb1f6f32
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 6, 2026.

Transparency log

Release files / brotli_rs-9.1.1.post1-cp311-abi3-win_amd64.whl

Download URL brotli_rs-9.1.1.post1-cp311-abi3-win_amd64.whl
Size 856.3 kB
Tags CPython 3.11 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
9e7ad482eee511c15043a73dcb92bf8b9f5b1a4f1c22246eddd8cd8520ae885a
BLAKE2b-256 checksum
How to use checksums
95c5915edc1f870717ec6fa453ab6824955f64d3119d9a22afb13f0eba87cf48
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 6, 2026.

Transparency log

Release files / brotli_rs-9.1.1.post1-cp311-abi3-musllinux_1_2_x86_64.whl

Download URL brotli_rs-9.1.1.post1-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
7389c65a497a60fc1b7acef6e45b79f84dfb0a9b672a504692d372d56565bd5e
BLAKE2b-256 checksum
How to use checksums
c0ca23dc2b1f0f84715733090b77df2ceb153bff56fe15be35eda449badc731e
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 6, 2026.

Transparency log

Release files / brotli_rs-9.1.1.post1-cp311-abi3-musllinux_1_2_aarch64.whl

Download URL brotli_rs-9.1.1.post1-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
dd9c3f84af62135bb190bc14c47d9251449612512c8262a215aa2ded166cb962
BLAKE2b-256 checksum
How to use checksums
a81b9d6a1f842a21b1ddde929ca3170f6c9f77068df83e32d1e68b955860de60
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 6, 2026.

Transparency log

Release files / brotli_rs-9.1.1.post1-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL brotli_rs-9.1.1.post1-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
48ef0bf445347f6fca8c875e78b639bf302beeb308637ec65edf755bec738bd2
BLAKE2b-256 checksum
How to use checksums
8c6ad3486d2b343b41c9125c0b3090d597034585259273503201cab9dea01d40
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 6, 2026.

Transparency log

Release files / brotli_rs-9.1.1.post1-cp311-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL brotli_rs-9.1.1.post1-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
968ee7d6a95fe6684b12d33b81fa70c2571280d483ab54b9b54a003987b4a256
BLAKE2b-256 checksum
How to use checksums
d14831841e7f5d9a073ca099e54c0ac09d0453172779b35862ab90376a2072bd
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 6, 2026.

Transparency log

Release files / brotli_rs-9.1.1.post1-cp311-abi3-macosx_11_0_arm64.whl

Download URL brotli_rs-9.1.1.post1-cp311-abi3-macosx_11_0_arm64.whl
Size 977.4 kB
Tags CPython 3.11 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
5f84a58512d49eb4abf8c0d71b6afd1d0d8502330b0356ee1948d54d03ce5a3a
BLAKE2b-256 checksum
How to use checksums
2edf259bf7398bd2e63f408091d4da464c8dc1ae840bf3a3987af21fcc749cee
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 6, 2026.

Transparency log

Release files / brotli_rs-9.1.1.post1-cp311-abi3-macosx_10_12_x86_64.whl

Download URL brotli_rs-9.1.1.post1-cp311-abi3-macosx_10_12_x86_64.whl
Size 969.8 kB
Tags CPython 3.11 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
24ea7e93a4275e64163f5dc9144b062d4833c82569ee988191847a209c63b24f
BLAKE2b-256 checksum
How to use checksums
aacb19bdaf618224bc7403e0cede2e3540071e052a78197e765a2742b9113f3e
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 6, 2026.

Transparency log

Security for brotli-rs 9.1.1.post1

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.1.post1.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 6, 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