Skip to main content

brotli-rs

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

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.

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__. 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.

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.1.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.1.0
File Size Uploaded Provenance Actions
brotli_rs-9.1.0.tar.gz 1.7 MB With provenance Details for brotli_rs-9.1.0.tar.gz

Built distributions (wheels)

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

Total release size: 9.6 MB

Release files / brotli_rs-9.1.0.tar.gz

Download URL brotli_rs-9.1.0.tar.gz
Size 1.7 MB
Tags Source
SHA-256 checksum
How to use checksums
deea14aebc3c3aa1d0d347a5e5a1f536bd7419a6262a1f28e01a866fb013476b
BLAKE2b-256 checksum
How to use checksums
a6a0c24ea984f1798f1e3f40f115eac9a92468c4fd30c5fac074486357089098
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 26, 2026.

Transparency log

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

Download URL brotli_rs-9.1.0-cp311-abi3-win_arm64.whl
Size 837.6 kB
Tags CPython 3.11 Windows ARM64 abi3
SHA-256 checksum
How to use checksums
4b8951c4baf19ab8b530f2e47dd7f67ee616e919b6d3a6e3da0ec971125a0445
BLAKE2b-256 checksum
How to use checksums
d00a19115ca3bf688078c26b43e4ecb94b7662b191e0ca2a99e211f67a9fb24c
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 26, 2026.

Transparency log

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

Download URL brotli_rs-9.1.0-cp311-abi3-win_amd64.whl
Size 841.9 kB
Tags CPython 3.11 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
2e92abf0ea79959567259673ff1a2b41430164dbc3d293f89443e30d2429ad16
BLAKE2b-256 checksum
How to use checksums
b4a86a1647eeb5ad9b60b6973cd9c2bf809466eaafaa99322dbb5434eec7d3c1
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 26, 2026.

Transparency log

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

Download URL brotli_rs-9.1.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
dd953c5db502272007a8c6cab9fab8207b938a0fff0dac9f3dadb7cf5fbb7570
BLAKE2b-256 checksum
How to use checksums
2bd0716e036ebda9f01c77dcd8c7e8a4414ec473dead2ad7717b64d1405c730c
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 26, 2026.

Transparency log

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

Download URL brotli_rs-9.1.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
00186ae55047d912ab3b7687f3ccbbb98579f31ec45272af9f9260573c0ae493
BLAKE2b-256 checksum
How to use checksums
4f05b04a3df205e70624d65e79a594ce6e7735ac8c603e753ff60044898b8051
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 26, 2026.

Transparency log

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

Download URL brotli_rs-9.1.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 995.9 kB
Tags CPython 3.11 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
2a27260d4ae797cc041adbbb2fb69319113a241c7a170eec1483b98ebd632729
BLAKE2b-256 checksum
How to use checksums
a92cc5a5f4cdac2074cbe1e1acd68022b6c38ee7be5498b37d058ef506ec8c96
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 26, 2026.

Transparency log

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

Download URL brotli_rs-9.1.0-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 996.2 kB
Tags CPython 3.11 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
2963dae160be1489c65f818c418d120efd11f82c64c9e84906b9f51a2033fec4
BLAKE2b-256 checksum
How to use checksums
b94616205054b6263cbd209ee090812aada7f0c8af36cfd9f38da4eeafa936d4
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 26, 2026.

Transparency log

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

Download URL brotli_rs-9.1.0-cp311-abi3-macosx_11_0_arm64.whl
Size 954.8 kB
Tags CPython 3.11 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
a3bd30d406f671a7e9178ac0eae098931d0804e0a2377b39d41909e4f380b93b
BLAKE2b-256 checksum
How to use checksums
87d92f695256cc4d82497ca269f47789ed52b6ff2edd95f8027fb8c90ad65a3a
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 26, 2026.

Transparency log

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

Download URL brotli_rs-9.1.0-cp311-abi3-macosx_10_12_x86_64.whl
Size 945.1 kB
Tags CPython 3.11 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
5330df08bf80799c779967901ef7b4c926b08805c7fa846ccea99f25ad4b28ed
BLAKE2b-256 checksum
How to use checksums
84eabffa992242e2d64209489f7632fa82fc1ee43a33e8142c2a43d58bc6918f
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 26, 2026.

Transparency log

Security for brotli-rs 9.1.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.1.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 26, 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