Skip to main content

Python CFFI bindings to the Brotli library

Project description

BrotliCFFI

Version 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

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

Files for brotlicffi, version 1.0.9.2
Filename, size File type Python version Upload date Hashes
Filename, size brotlicffi-1.0.9.2-cp27-cp27m-macosx_10_9_x86_64.whl (427.1 kB) File type Wheel Python version cp27 Upload date Hashes View
Filename, size brotlicffi-1.0.9.2-cp27-cp27m-manylinux1_i686.whl (2.6 MB) File type Wheel Python version cp27 Upload date Hashes View
Filename, size brotlicffi-1.0.9.2-cp27-cp27m-manylinux1_x86_64.whl (2.7 MB) File type Wheel Python version cp27 Upload date Hashes View
Filename, size brotlicffi-1.0.9.2-cp27-cp27m-manylinux2010_i686.whl (2.6 MB) File type Wheel Python version cp27 Upload date Hashes View
Filename, size brotlicffi-1.0.9.2-cp27-cp27m-manylinux2010_x86_64.whl (2.7 MB) File type Wheel Python version cp27 Upload date Hashes View
Filename, size brotlicffi-1.0.9.2-cp27-cp27mu-manylinux1_i686.whl (2.6 MB) File type Wheel Python version cp27 Upload date Hashes View
Filename, size brotlicffi-1.0.9.2-cp27-cp27mu-manylinux1_x86_64.whl (2.7 MB) File type Wheel Python version cp27 Upload date Hashes View
Filename, size brotlicffi-1.0.9.2-cp27-cp27mu-manylinux2010_i686.whl (2.6 MB) File type Wheel Python version cp27 Upload date Hashes View
Filename, size brotlicffi-1.0.9.2-cp27-cp27mu-manylinux2010_x86_64.whl (2.7 MB) File type Wheel Python version cp27 Upload date Hashes View
Filename, size brotlicffi-1.0.9.2-cp35-abi3-macosx_10_9_x86_64.whl (427.2 kB) File type Wheel Python version cp35 Upload date Hashes View
Filename, size brotlicffi-1.0.9.2-cp35-abi3-manylinux1_i686.whl (2.6 MB) File type Wheel Python version cp35 Upload date Hashes View
Filename, size brotlicffi-1.0.9.2-cp35-abi3-manylinux1_x86_64.whl (2.7 MB) File type Wheel Python version cp35 Upload date Hashes View
Filename, size brotlicffi-1.0.9.2-cp35-abi3-manylinux2010_i686.whl (2.6 MB) File type Wheel Python version cp35 Upload date Hashes View
Filename, size brotlicffi-1.0.9.2-cp35-abi3-manylinux2010_x86_64.whl (2.7 MB) File type Wheel Python version cp35 Upload date Hashes View
Filename, size brotlicffi-1.0.9.2-cp35-abi3-manylinux2014_aarch64.whl (2.6 MB) File type Wheel Python version cp35 Upload date Hashes View
Filename, size brotlicffi-1.0.9.2-cp35-abi3-win32.whl (364.6 kB) File type Wheel Python version cp35 Upload date Hashes View
Filename, size brotlicffi-1.0.9.2-cp35-abi3-win_amd64.whl (397.7 kB) File type Wheel Python version cp35 Upload date Hashes View
Filename, size brotlicffi-1.0.9.2-pp27-pypy_73-macosx_10_9_x86_64.whl (377.6 kB) File type Wheel Python version pp27 Upload date Hashes View
Filename, size brotlicffi-1.0.9.2-pp27-pypy_73-manylinux1_x86_64.whl (360.9 kB) File type Wheel Python version pp27 Upload date Hashes View
Filename, size brotlicffi-1.0.9.2-pp27-pypy_73-manylinux2010_x86_64.whl (360.9 kB) File type Wheel Python version pp27 Upload date Hashes View
Filename, size brotlicffi-1.0.9.2-pp27-pypy_73-win32.whl (1.8 MB) File type Wheel Python version pp27 Upload date Hashes View
Filename, size brotlicffi-1.0.9.2-pp36-pypy36_pp73-macosx_10_9_x86_64.whl (377.7 kB) File type Wheel Python version pp36 Upload date Hashes View
Filename, size brotlicffi-1.0.9.2-pp36-pypy36_pp73-manylinux1_x86_64.whl (360.9 kB) File type Wheel Python version pp36 Upload date Hashes View
Filename, size brotlicffi-1.0.9.2-pp36-pypy36_pp73-manylinux2010_x86_64.whl (360.9 kB) File type Wheel Python version pp36 Upload date Hashes View
Filename, size brotlicffi-1.0.9.2-pp36-pypy36_pp73-win32.whl (362.0 kB) File type Wheel Python version pp36 Upload date Hashes View
Filename, size brotlicffi-1.0.9.2-pp37-pypy37_pp73-macosx_10_9_x86_64.whl (377.7 kB) File type Wheel Python version pp37 Upload date Hashes View
Filename, size brotlicffi-1.0.9.2-pp37-pypy37_pp73-manylinux1_x86_64.whl (360.9 kB) File type Wheel Python version pp37 Upload date Hashes View
Filename, size brotlicffi-1.0.9.2-pp37-pypy37_pp73-manylinux2010_x86_64.whl (360.9 kB) File type Wheel Python version pp37 Upload date Hashes View
Filename, size brotlicffi-1.0.9.2-pp37-pypy37_pp73-win32.whl (362.0 kB) File type Wheel Python version pp37 Upload date Hashes View
Filename, size brotlicffi-1.0.9.2.tar.gz (440.1 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page