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

Project details


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.0.tar.gz (476.7 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.0-pp311-pypy311_pp73-win_amd64.whl (374.7 kB view details)

Uploaded PyPyWindows x86-64

brotlicffi-1.2.0.0-pp311-pypy311_pp73-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (402.5 kB view details)

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

brotlicffi-1.2.0.0-pp311-pypy311_pp73-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (406.4 kB view details)

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

brotlicffi-1.2.0.0-pp311-pypy311_pp73-macosx_11_0_arm64.whl (402.0 kB view details)

Uploaded PyPymacOS 11.0+ ARM64

brotlicffi-1.2.0.0-cp38-abi3-win_amd64.whl (378.6 kB view details)

Uploaded CPython 3.8+Windows x86-64

brotlicffi-1.2.0.0-cp38-abi3-win32.whl (343.1 kB view details)

Uploaded CPython 3.8+Windows x86

brotlicffi-1.2.0.0-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.0-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.0-cp38-abi3-macosx_11_0_arm64.whl (432.3 kB view details)

Uploaded CPython 3.8+macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: brotlicffi-1.2.0.0.tar.gz
  • Upload date:
  • Size: 476.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.0

File hashes

Hashes for brotlicffi-1.2.0.0.tar.gz
Algorithm Hash digest
SHA256 34345d8d1f9d534fcac2249e57a4c3c8801a33c9942ff9f8574f67a175e17adb
MD5 131da94b8624542f3c36a061b1f37ab4
BLAKE2b-256 848557c314a6b35336efbbdc13e5fc9ae13f6b60a0647cfa7c1221178ac6d8ae

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for brotlicffi-1.2.0.0-pp311-pypy311_pp73-win_amd64.whl
Algorithm Hash digest
SHA256 3832c66e00d6d82087f20a972b2fc03e21cd99ef22705225a6f8f418a9158ecc
MD5 2ee819f0087d5d746137aaf4541125a5
BLAKE2b-256 b5d3b07f8f125ac52bbee5dc00ef0d526f820f67321bf4184f915f17f50a4657

See more details on using hashes here.

File details

Details for the file brotlicffi-1.2.0.0-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.0-pp311-pypy311_pp73-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 fb4eb5830026b79a93bf503ad32b2c5257315e9ffc49e76b2715cffd07c8e3db
MD5 7699ef79cc03177320766a71ad1ae369
BLAKE2b-256 624e5554ecb2615ff035ef8678d4e419549a0f7a28b3f096b272174d656749fb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for brotlicffi-1.2.0.0-pp311-pypy311_pp73-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 7d3c4332fc808a94e8c1035950a10d04b681b03ab585ce897ae2a360d479037c
MD5 d5710ab214ee29c47c8d9b84c5093a8a
BLAKE2b-256 e463d4aea4835fd97da1401d798d9b8ba77227974de565faea402f520b37b10f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for brotlicffi-1.2.0.0-pp311-pypy311_pp73-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 fa102a60e50ddbd08de86a63431a722ea216d9bc903b000bf544149cc9b823dc
MD5 494aa170e65ff7c27e9bb83d35780310
BLAKE2b-256 a4ec52488a0563f1663e2ccc75834b470650f4b8bcdea3132aef3bf67219c661

See more details on using hashes here.

File details

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

File metadata

  • Download URL: brotlicffi-1.2.0.0-cp38-abi3-win_amd64.whl
  • Upload date:
  • Size: 378.6 kB
  • Tags: CPython 3.8+, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.0

File hashes

Hashes for brotlicffi-1.2.0.0-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 f139a7cdfe4ae7859513067b736eb44d19fae1186f9e99370092f6915216451b
MD5 5bd06774ae018e321ba04ca990dc374f
BLAKE2b-256 076b6e92009df3b8b7272f85a0992b306b61c34b7ea1c4776643746e61c380ac

See more details on using hashes here.

File details

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

File metadata

  • Download URL: brotlicffi-1.2.0.0-cp38-abi3-win32.whl
  • Upload date:
  • Size: 343.1 kB
  • Tags: CPython 3.8+, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.0

File hashes

Hashes for brotlicffi-1.2.0.0-cp38-abi3-win32.whl
Algorithm Hash digest
SHA256 23e5c912fdc6fd37143203820230374d24babd078fc054e18070a647118158f6
MD5 feca6ae49d1adbbd3f781a6017e0c78f
BLAKE2b-256 1b37293a9a0a7caf17e6e657668bebb92dfe730305999fe8c0e2703b8888789c

See more details on using hashes here.

File details

Details for the file brotlicffi-1.2.0.0-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.0-cp38-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 33cfb408d0cff64cd50bef268c0fed397c46fbb53944aa37264148614a62e990
MD5 8ba3546b9d2a82f0dd68978361b93a46
BLAKE2b-256 e49cd51486bf366fc7d6735f0e46b5b96ca58dc005b250263525a1eea3cd5d21

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for brotlicffi-1.2.0.0-cp38-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 84e3d0020cf1bd8b8131f4a07819edee9f283721566fe044a20ec792ca8fd8b7
MD5 0d5a9a518cb9ad2449b21dc915be6332
BLAKE2b-256 742bcc55a2d1d6fb4f5d458fba44a3d3f91fb4320aa14145799fd3a996af0686

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for brotlicffi-1.2.0.0-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9458d08a7ccde8e3c0afedbf2c70a8263227a68dea5ab13590593f4c0a4fd5f4
MD5 9b1a74e113b5920b5f86eb294007b265
BLAKE2b-256 e4dfa72b284d8c7bef0ed5756b41c2eb7d0219a1dd6ac6762f1c7bdbc31ef3af

See more details on using hashes here.

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