Skip to main content

Python CFFI bindings to the Brotli library

Project description

BrotliCFFI

Version Version-Conda Downloads CI Status

This library contains Python CFFI bindings for the reference Brotli encoder/decoder, available here. This allows Python software to use the Brotli compression algorithm directly from Python code.

Install from PyPI:

$ python -m pip install brotlicffi

Install from Conda:

$ conda install -c conda-forge brotlicffi

To use it simply, try this:

import brotlicffi
data = brotlicffi.decompress(compressed_data)

More information can be found in the documentation.

Using BrotliCFFI in Projects

The API is 100% compatible with the Brotli Python C bindings. We recommend installing the C bindings on CPython and the CFFI bindings everywhere else (PyPy, etc)

Essentially you use requirements like this:

install_requires=[
    "brotli; platform_python_implementation == 'CPython'",
    "brotlicffi; platform_python_implementation != 'CPython'"
]

and then import the correct Brotli library like so:

try:
    import brotlicffi as brotli
except ImportError:
    import brotli

We provide an example project that shows how to use both libraries together to support Brotli with multiple Python implementations.

License

The source code of BrotliCFFI is available under the MIT license. Brotli itself is made available under the Version 2.0 of the Apache Software License. See the LICENSE and libbrotli/LICENSE files for more information.

Authors

BrotliCFFI/brotlipy was authored by Cory Benfield and is currently maintained by Seth Michael Larson.

Changelog

1.2.0.1 (2025-03-05)

  • Added support for the free-threaded build of Python 3.14.

  • Concurrent sharing of Compressor or Decompressor objects now raises an exception.

1.2.0.0 (2025-11-21)

  • Upgraded libbrotli to v1.2.0.

  • Added output_buffer_limit parameter to Decompressor.decompress() and Decompressor.process() methods to allow mitigation of unexpectedly large output. This addresses potential security concerns where maliciously crafted compressed data could result in excessive memory usage during decompression.

1.1.0.0 (2023-09-14)

  • Upgraded libbrotli to v1.1.0

  • Added explicit support for Python 3.10, 3.11, and 3.12

  • Removed support for Python 2.7, 3.5, and 3.6

1.0.9.2 (2021-04-06)

  • Added manylinux_aarch64 wheels

1.0.9.1 (2021-01-27)

  • Avoid byte/string comparison warning in error message construction

1.0.9.0 (2021-01-20)

  • Updated to v1.0.9 of the Brotli library

  • Library version now follows Brotli version

  • Removed the dictionary parameter from compress and Compressor

  • NOTE: Python 2.7 wheels for Windows likely won’t work until google/brotli#848 is resolved

0.8.0 (2020-11-30)

  • Renamed the package on PyPI to brotlicffi, all further updates will be published to the new package. Using the brotlipy is deprecated.

  • Changed the importable namespace from brotli to brotlicffi to no longer conflict with the Brotli PyPI package.

  • Added process() method to Compressor and Decompressor.

  • Added is_finished() method to Decompressor.

0.7.0 (2017-05-30)

  • Update to v0.6.0 of the Brotli library.

0.6.0 (2016-09-08)

  • Resolved a bug where decompress() would return an empty bytestring instead of erroring if the provided bytestring was small enough.

  • Added the finish() method to the streaming decompressor.

0.5.1 (2016-08-17)

  • Update to v0.5.2 of the Brotli library.

  • Add new exception type (Error).

  • Add compatibility with C++ brotli library by aliasing Error to error.

  • Extra error checking of input parameters to the compressor.

0.5.0 (2016-08-16)

  • Update to v0.5.0 of the Brotli library.

  • Extend one-shot compression API to include all control parameters.

  • Added streaming/incremental compression API.

  • Added flags to control compression mode.

0.4.0 (2016-08-01)

Update to v0.4.0 of the Brotli library.

0.3.0 (2016-05-11)

Update to v0.3.0 of the Brotli library.

0.2.0 (2015-10-05)

Fix broken brotli.compress support on Windows.

0.1.3 (2015-10-05)

  • Added basic for brotli.compress through a C wrapper included in this library.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

brotlicffi-1.2.0.1.tar.gz (478.2 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

brotlicffi-1.2.0.1-pp311-pypy311_pp73-win_amd64.whl (375.1 kB view details)

Uploaded PyPyWindows x86-64

brotlicffi-1.2.0.1-pp311-pypy311_pp73-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (402.8 kB view details)

Uploaded PyPymanylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

brotlicffi-1.2.0.1-pp311-pypy311_pp73-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (406.7 kB view details)

Uploaded PyPymanylinux: glibc 2.17+ ARM64manylinux: glibc 2.28+ ARM64

brotlicffi-1.2.0.1-pp311-pypy311_pp73-macosx_11_0_arm64.whl (402.3 kB view details)

Uploaded PyPymacOS 11.0+ ARM64

brotlicffi-1.2.0.1-cp314-cp314t-win_amd64.whl (385.7 kB view details)

Uploaded CPython 3.14tWindows x86-64

brotlicffi-1.2.0.1-cp314-cp314t-win32.whl (349.0 kB view details)

Uploaded CPython 3.14tWindows x86

brotlicffi-1.2.0.1-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (1.5 MB view details)

Uploaded CPython 3.14tmanylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

brotlicffi-1.2.0.1-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (1.5 MB view details)

Uploaded CPython 3.14tmanylinux: glibc 2.17+ ARM64manylinux: glibc 2.28+ ARM64

brotlicffi-1.2.0.1-cp314-cp314t-macosx_11_0_arm64.whl (433.0 kB view details)

Uploaded CPython 3.14tmacOS 11.0+ ARM64

brotlicffi-1.2.0.1-cp38-abi3-win_amd64.whl (379.0 kB view details)

Uploaded CPython 3.8+Windows x86-64

brotlicffi-1.2.0.1-cp38-abi3-win32.whl (343.3 kB view details)

Uploaded CPython 3.8+Windows x86

brotlicffi-1.2.0.1-cp38-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (1.5 MB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

brotlicffi-1.2.0.1-cp38-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (1.5 MB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ ARM64manylinux: glibc 2.28+ ARM64

brotlicffi-1.2.0.1-cp38-abi3-macosx_11_0_arm64.whl (432.6 kB view details)

Uploaded CPython 3.8+macOS 11.0+ ARM64

File details

Details for the file brotlicffi-1.2.0.1.tar.gz.

File metadata

  • Download URL: brotlicffi-1.2.0.1.tar.gz
  • Upload date:
  • Size: 478.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for brotlicffi-1.2.0.1.tar.gz
Algorithm Hash digest
SHA256 c20d5c596278307ad06414a6d95a892377ea274a5c6b790c2548c009385d621c
MD5 4361067db426b6f96f1c1d452f96164f
BLAKE2b-256 8ab6017dc5f852ed9b8735af77774509271acbf1de02d238377667145fcee01d

See more details on using hashes here.

Provenance

The following attestation bundles were made for brotlicffi-1.2.0.1.tar.gz:

Publisher: ci.yml on python-hyper/brotlicffi

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file brotlicffi-1.2.0.1-pp311-pypy311_pp73-win_amd64.whl.

File metadata

File hashes

Hashes for brotlicffi-1.2.0.1-pp311-pypy311_pp73-win_amd64.whl
Algorithm Hash digest
SHA256 f2a5575653b0672638ba039b82fda56854934d7a6a24d4b8b5033f73ab43cbc1
MD5 070cb40c0dd5c7e60a759215f661bcb9
BLAKE2b-256 ef6f534205ba7590c9a8716a614f270c5c2ec419b5b7079b3f9cd31b7b5580de

See more details on using hashes here.

Provenance

The following attestation bundles were made for brotlicffi-1.2.0.1-pp311-pypy311_pp73-win_amd64.whl:

Publisher: ci.yml on python-hyper/brotlicffi

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file brotlicffi-1.2.0.1-pp311-pypy311_pp73-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for brotlicffi-1.2.0.1-pp311-pypy311_pp73-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 9d6ba65dd528892b4d9960beba2ae011a753620bcfc66cf6fa3cee18d7b0baa4
MD5 f3ad11d14e2d42432a5110eb650d6e90
BLAKE2b-256 a382dbced4c1e0792efdf23fd90ff6d2a320c64ff4dfef7aacc85c04fde9ddd2

See more details on using hashes here.

Provenance

The following attestation bundles were made for brotlicffi-1.2.0.1-pp311-pypy311_pp73-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl:

Publisher: ci.yml on python-hyper/brotlicffi

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file brotlicffi-1.2.0.1-pp311-pypy311_pp73-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for brotlicffi-1.2.0.1-pp311-pypy311_pp73-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 37cb587d32bf7168e2218c455e22e409ad1f3157c6c71945879a311f3e6b6abf
MD5 2edb46f547d3dd36620cd4a88604204a
BLAKE2b-256 1fd9d5340b43cf5fbe7fe5a083d237e5338cc1caa73bea523be1c5e452c26290

See more details on using hashes here.

Provenance

The following attestation bundles were made for brotlicffi-1.2.0.1-pp311-pypy311_pp73-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl:

Publisher: ci.yml on python-hyper/brotlicffi

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file brotlicffi-1.2.0.1-pp311-pypy311_pp73-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for brotlicffi-1.2.0.1-pp311-pypy311_pp73-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e015af99584c6db1490a69a210c765953e473e63adc2d891ac3062a737c9e851
MD5 2016825b66e015b0fe6831c6945747e8
BLAKE2b-256 7f536262c2256513e6f530d81642477cb19367270922063eaa2d7b781d8c723d

See more details on using hashes here.

Provenance

The following attestation bundles were made for brotlicffi-1.2.0.1-pp311-pypy311_pp73-macosx_11_0_arm64.whl:

Publisher: ci.yml on python-hyper/brotlicffi

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file brotlicffi-1.2.0.1-cp314-cp314t-win_amd64.whl.

File metadata

File hashes

Hashes for brotlicffi-1.2.0.1-cp314-cp314t-win_amd64.whl
Algorithm Hash digest
SHA256 625f8115d32ae9c0740d01ea51518437c3fbaa3e78d41cb18459f6f7ac326000
MD5 564a92fae15b803c5af3d3c1751bf233
BLAKE2b-256 ab9813e5b250236a281b6cd9e92a01ee1ae231029fa78faee932ef3766e1cb24

See more details on using hashes here.

Provenance

The following attestation bundles were made for brotlicffi-1.2.0.1-cp314-cp314t-win_amd64.whl:

Publisher: ci.yml on python-hyper/brotlicffi

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file brotlicffi-1.2.0.1-cp314-cp314t-win32.whl.

File metadata

  • Download URL: brotlicffi-1.2.0.1-cp314-cp314t-win32.whl
  • Upload date:
  • Size: 349.0 kB
  • Tags: CPython 3.14t, Windows x86
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for brotlicffi-1.2.0.1-cp314-cp314t-win32.whl
Algorithm Hash digest
SHA256 3c9544f83cb715d95d7eab3af4adbbef8b2093ad6382288a83b3a25feb1a57ec
MD5 2db180c764a07b536e7990b48003493e
BLAKE2b-256 47c080ecd9bd45776109fab14040e478bf63e456967c9ddee2353d8330ed8de1

See more details on using hashes here.

Provenance

The following attestation bundles were made for brotlicffi-1.2.0.1-cp314-cp314t-win32.whl:

Publisher: ci.yml on python-hyper/brotlicffi

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file brotlicffi-1.2.0.1-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for brotlicffi-1.2.0.1-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 ce17eb798ca59ecec67a9bb3fd7a4304e120d1cd02953ce522d959b9a84d58ac
MD5 4bb6b4a0159d53208f7c2ab204c9ec1c
BLAKE2b-256 3be1ff87af10ac419600c63e9287a0649c673673ae6b4f2bcf48e96cb2f89f60

See more details on using hashes here.

Provenance

The following attestation bundles were made for brotlicffi-1.2.0.1-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl:

Publisher: ci.yml on python-hyper/brotlicffi

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file brotlicffi-1.2.0.1-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for brotlicffi-1.2.0.1-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 535f2d05d0273408abc13fc0eebb467afac17b0ad85090c8913690d40207dac5
MD5 5b5b3a61142a924aecb70d4b5bf0ed64
BLAKE2b-256 4af5f8f492158c76b0d940388801f04f747028971ad5774287bded5f1e53f08d

See more details on using hashes here.

Provenance

The following attestation bundles were made for brotlicffi-1.2.0.1-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl:

Publisher: ci.yml on python-hyper/brotlicffi

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file brotlicffi-1.2.0.1-cp314-cp314t-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for brotlicffi-1.2.0.1-cp314-cp314t-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2c85e65913cf2b79c57a3fdd05b98d9731d9255dc0cb696b09376cc091b9cddd
MD5 7b357011261226b47496e91782c122f8
BLAKE2b-256 eff9dfa56316837fa798eac19358351e974de8e1e2ca9475af4cb90293cd6576

See more details on using hashes here.

Provenance

The following attestation bundles were made for brotlicffi-1.2.0.1-cp314-cp314t-macosx_11_0_arm64.whl:

Publisher: ci.yml on python-hyper/brotlicffi

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file brotlicffi-1.2.0.1-cp38-abi3-win_amd64.whl.

File metadata

  • Download URL: brotlicffi-1.2.0.1-cp38-abi3-win_amd64.whl
  • Upload date:
  • Size: 379.0 kB
  • Tags: CPython 3.8+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for brotlicffi-1.2.0.1-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 da2e82a08e7778b8bc539d27ca03cdd684113e81394bfaaad8d0dfc6a17ddede
MD5 583d94d2bfc843e0196b16b6296d6bbc
BLAKE2b-256 d8efe7e485ce5e4ba3843a0a92feb767c7b6098fd6e65ce752918074d175ae71

See more details on using hashes here.

Provenance

The following attestation bundles were made for brotlicffi-1.2.0.1-cp38-abi3-win_amd64.whl:

Publisher: ci.yml on python-hyper/brotlicffi

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file brotlicffi-1.2.0.1-cp38-abi3-win32.whl.

File metadata

  • Download URL: brotlicffi-1.2.0.1-cp38-abi3-win32.whl
  • Upload date:
  • Size: 343.3 kB
  • Tags: CPython 3.8+, Windows x86
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for brotlicffi-1.2.0.1-cp38-abi3-win32.whl
Algorithm Hash digest
SHA256 82ea52e2b5d3145b6c406ebd3efb0d55db718b7ad996bd70c62cec0439de1187
MD5 7df751b1cb74bfae278758562c043448
BLAKE2b-256 a6756e7977d1935fc3fbb201cbd619be8f2c7aea25d40a096967132854b34708

See more details on using hashes here.

Provenance

The following attestation bundles were made for brotlicffi-1.2.0.1-cp38-abi3-win32.whl:

Publisher: ci.yml on python-hyper/brotlicffi

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file brotlicffi-1.2.0.1-cp38-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for brotlicffi-1.2.0.1-cp38-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 6f3314a3476f59e5443f9f72a6dff16edc0c3463c9b318feaef04ae3e4683f5a
MD5 06e8ab0ba54c9fe1857e025201ed9fb3
BLAKE2b-256 9939e7410db7f6f56de57744ea52a115084ceb2735f4d44973f349bb92136586

See more details on using hashes here.

Provenance

The following attestation bundles were made for brotlicffi-1.2.0.1-cp38-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl:

Publisher: ci.yml on python-hyper/brotlicffi

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file brotlicffi-1.2.0.1-cp38-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for brotlicffi-1.2.0.1-cp38-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 be9a670c6811af30a4bd42d7116dc5895d3b41beaa8ed8a89050447a0181f5ce
MD5 70c5221db529576b267cc50fefc3164c
BLAKE2b-256 b17aac4ee56595a061e3718a6d1ea7e921f4df156894acffb28ed88a1fd52022

See more details on using hashes here.

Provenance

The following attestation bundles were made for brotlicffi-1.2.0.1-cp38-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl:

Publisher: ci.yml on python-hyper/brotlicffi

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file brotlicffi-1.2.0.1-cp38-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for brotlicffi-1.2.0.1-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 91ba5f0ccc040f6ff8f7efaf839f797723d03ed46acb8ae9408f99ffd2572cf4
MD5 784054177195849ee254a30fc1ee251a
BLAKE2b-256 9a9fb98dcd4af47994cee97aebac866996a006a2e5fc1fd1e2b82a8ad95cf09c

See more details on using hashes here.

Provenance

The following attestation bundles were made for brotlicffi-1.2.0.1-cp38-abi3-macosx_11_0_arm64.whl:

Publisher: ci.yml on python-hyper/brotlicffi

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page