--- id: brotlicffi version: "1.2.0.1" license: MIT license_treatment: permissive maintenance: active --- # brotlicffi — Python CFFI bindings to the Brotli library License: permissive · Maintenance: active · Downloads: 4.3M/mo ## What it is and what it does BrotliCFFI is a Python wrapper around the Brotli compression algorithm, implemented using CFFI (C Foreign Function Interface) rather than C extensions. It provides both one-shot compression/decompression functions and streaming APIs for incremental processing. The package is designed as a drop-in alternative to the native Brotli C bindings, with identical API compatibility, making it particularly useful for PyPy and other non-CPython implementations where C extensions are impractical. The library depends only on cffi and wraps the reference Brotli encoder/decoder from Google. It supports modern Python versions (3.8 through 3.14, including free-threaded builds) and multiple platforms. Recent versions include security-focused features like output buffer limits to mitigate decompression bombs, and explicit exception handling for concurrent access to compressor/decompressor objects. Use it for: - Decompress Brotli-encoded HTTP responses in web clients or servers running PyPy or alternative Python implementations. - Streaming compression of large files or network data using the Compressor/Decompressor classes with incremental processing. - Cross-implementation Python projects that need Brotli support on both CPython and PyPy using conditional dependencies. - Protect against maliciously crafted compressed data by setting output_buffer_limit on decompression operations. - Build HTTP middleware or reverse proxies that handle Brotli content encoding on platforms where C extensions are unavailable. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Provides Python CFFI bindings to the Brotli compression library, enabling Brotli compression and decompression from Python code with an API compatible with the C bindings. Yes, if you need Brotli compression on PyPy or other non-CPython implementations, or if you prefer CFFI-based bindings over C extensions. On CPython, the native Brotli package is typically preferred for performance, but this package is a solid alternative with active maintenance, no known vulnerabilities, and permissive licensing. Install friction is moderate but manageable with pre-built wheels for common platforms. ## Install pip install brotlicffi uv add brotlicffi poetry add brotlicffi ## Installing brotlicffi Before you install: Medium install friction due to compiled wheels; pre-built binaries available for common platforms (CPython 3.8+, PyPy 3.11) and architectures (x86_64, aarch64, ARM, Windows). Actively maintained with recent release (162 days old) and ongoing repository activity. License in practice: MIT license on the Python bindings themselves; the underlying Brotli library is Apache 2.0. Both are permissive, allowing commercial and private use without restriction. Quickstart: pip install brotlicffi import brotlicffi data = brotlicffi.decompress(compressed_data) Requires Python 3.8 or later; PyPy support available via CFFI bindings as an alternative to the C implementation. Verify before relying: - Whether the output_buffer_limit parameter (added in 1.2.0.0) is documented and how to use it effectively for security. - Performance characteristics compared to the native Brotli C bindings on CPython. - Thread safety guarantees beyond the documented exception for concurrent Compressor/Decompressor sharing. ## Package facts - License: MIT (permissive) - Python support: supports_current - Install friction: medium - Maintenance: active - Downloads: 4.3M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags brotli compression python, cffi bindings compression, brotli decompression library, streaming compression python, pypy brotli support, compression, cffi, pypy-compatible [View on SkillFed](https://skillfed.io/packages/brotlicffi) · [View on PyPI](https://pypi.org/project/brotlicffi/)