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

Built distributions (wheels)

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

Total release size: 10.8 MB

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

Download URL brotli_rs-9.1.3.post1.tar.gz
Size 2.7 MB
Tags Source
SHA-256 checksum
How to use checksums
f51eca53e1a419a3048053db149a77bd5b6744a92b2ece2430adf132138683d0
BLAKE2b-256 checksum
How to use checksums
ab7c5e745ba49bdd9eaa6738313fafb45ba387436ce15c25f7924d8b0565cb27
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 24, 2026.

Transparency log

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

Download URL brotli_rs-9.1.3.post1-cp311-abi3-win_arm64.whl
Size 851.9 kB
Tags CPython 3.11 Windows ARM64 abi3
SHA-256 checksum
How to use checksums
466aefc1f0d5f96536c5d6380895375a6a31c853f1448e8bd69e55336cecd147
BLAKE2b-256 checksum
How to use checksums
0f1acafe5cf9e8bd23167eda1f6635a5126cc77f1e0056660a48191a6208243d
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 24, 2026.

Transparency log

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

Download URL brotli_rs-9.1.3.post1-cp311-abi3-win_amd64.whl
Size 856.6 kB
Tags CPython 3.11 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
ac8aa94f6026098027200f5d05f14c6e3639efc2fef3cb715437e5ac00d3369f
BLAKE2b-256 checksum
How to use checksums
a166fa4b9ab57c20cb4914f8ce9274fd9e737ec2d9848560603d9cd5e6afa200
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 24, 2026.

Transparency log

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

Download URL brotli_rs-9.1.3.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
1d927ec41da5695759896830785f47a77dc267d1f0d687b3b62dff29ff0d4a72
BLAKE2b-256 checksum
How to use checksums
6093b4da75996518bf47e86dc3aa129056ba71db860df7f417a304cc94e4b02e
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 24, 2026.

Transparency log

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

Download URL brotli_rs-9.1.3.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
0ceed466cce70fcc1e2c6da7e87fe859632a7e32912084030ca18e248fd77e77
BLAKE2b-256 checksum
How to use checksums
2b533254c3019ac040a0323078e0002ca2a9148e39eb240935fb0f3e72c55c86
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 24, 2026.

Transparency log

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

Download URL brotli_rs-9.1.3.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
25300fd5c20ab37a1091f48543613a802bee3196809df0bf6923bd5ccf7876ee
BLAKE2b-256 checksum
How to use checksums
64923743076fe58e03e2354d71095c52d9808bcd64e3272b7372cee1907322f0
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 24, 2026.

Transparency log

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

Download URL brotli_rs-9.1.3.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
7f25690085df29741c5990258897fb60dd42e02a64efacd861449a7586fb9761
BLAKE2b-256 checksum
How to use checksums
f5aa29f39818ce260f36f0555541aa61a95ab5a5d516022177a7700b9addec44
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 24, 2026.

Transparency log

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

Download URL brotli_rs-9.1.3.post1-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
a9efe499096e30b4b80a6abb4822fae935992dc9ba0751113497908f73994dd5
BLAKE2b-256 checksum
How to use checksums
314bd790ae851c932c5d6aad5e3205185fe0347a55dc8a3e13bb6a7a229fbb5d
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 24, 2026.

Transparency log

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

Download URL brotli_rs-9.1.3.post1-cp311-abi3-macosx_10_12_x86_64.whl
Size 970.6 kB
Tags CPython 3.11 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
04da1d0b41df76ef5b1e7aae3ad6d84d2ebd816cc552f6c899d4aafb16fb2542
BLAKE2b-256 checksum
How to use checksums
5a9089c32e83a9a65a621b590281a105a059b6a54cd88d1a61029bcfe21fd443
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 24, 2026.

Transparency log

Security for brotli-rs 9.1.3.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.3.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 24, 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