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

Built distributions (wheels)

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

Total release size: 10.8 MB

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

Download URL brotli_rs-9.1.1.post2.tar.gz
Size 2.7 MB
Tags Source
SHA-256 checksum
How to use checksums
f09ceedc1f7dac5cefc884b68ca83cd0fb906c83ad224e33dbf326f2719072d9
BLAKE2b-256 checksum
How to use checksums
2aeadac69ca732b57a1c7bdc9b6430578c59212609066834adda996d70e7be56
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 10, 2026.

Transparency log

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

Download URL brotli_rs-9.1.1.post2-cp311-abi3-win_arm64.whl
Size 851.5 kB
Tags CPython 3.11 Windows ARM64 abi3
SHA-256 checksum
How to use checksums
dbcccef10a8340b4d6e7704aaff7cdcbf7b5c3ec48712fdc8b3b68bfd85895ad
BLAKE2b-256 checksum
How to use checksums
ffd525953d385e4dcc74e171f359732978e882ff06caf7eaca7486bb8e95eab9
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 10, 2026.

Transparency log

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

Download URL brotli_rs-9.1.1.post2-cp311-abi3-win_amd64.whl
Size 856.3 kB
Tags CPython 3.11 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
2862e9f732532c3d5b49bcfa6d2b0f1b53f8a3fa317da3fce6b713bbf2eb8da3
BLAKE2b-256 checksum
How to use checksums
a6b967ae2ed62964ced7ef5ad405acc30e8c2694160e9cc6d3897a290816513c
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 10, 2026.

Transparency log

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

Download URL brotli_rs-9.1.1.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
b1f639f1e1226f24451a810faf19fa4a3a82589f2db95494a2e9c5392a273ef4
BLAKE2b-256 checksum
How to use checksums
78862dcd207a1e88773947b8899ae74bac4e04b3bcb8a3a9431116dab8f008b6
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 10, 2026.

Transparency log

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

Download URL brotli_rs-9.1.1.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
693903cd7339ef7731326baa25839388bb834da4a1e809e4b182473532ed4a60
BLAKE2b-256 checksum
How to use checksums
fc70e5de5592e64541aed05f83b2969a7922b44f93d480f187125f1884574d61
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 10, 2026.

Transparency log

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

Download URL brotli_rs-9.1.1.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
ce577a8b65d600c80ce074d5b0c0b38239cd6cba049993595140baaa0a280160
BLAKE2b-256 checksum
How to use checksums
fa423fd95c05b0ebb9ef7e0c226f13df36161966b3ce68441f54c4f5d4bbb2ce
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 10, 2026.

Transparency log

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

Download URL brotli_rs-9.1.1.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
dd0064b437ad0df493346f86ef1a8bb4c09460e5d0a6f5e0271c154e09277acd
BLAKE2b-256 checksum
How to use checksums
08efbd42002587856a434c528dc7ba5267ea66088c1ed618c53a7a905737b14f
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 10, 2026.

Transparency log

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

Download URL brotli_rs-9.1.1.post2-cp311-abi3-macosx_11_0_arm64.whl
Size 978.7 kB
Tags CPython 3.11 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
cb3bad63afef3b6b972f599254468bec9f13735f0d93c36048f557abb31bf1d9
BLAKE2b-256 checksum
How to use checksums
be319a5f561cd149f8fb16f90115db38c7118f862795a601a1d790c3fb97e2a9
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 10, 2026.

Transparency log

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

Download URL brotli_rs-9.1.1.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
0e75947110ff9929d5d211c0ba32440cdcc81754b31856494735355e7a681838
BLAKE2b-256 checksum
How to use checksums
19909751f2d1990c9a717d2fe38471d6c784e5dc693db365a968330515029e0b
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 10, 2026.

Transparency log

Security for brotli-rs 9.1.1.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.1.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 10, 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