deflate
Python wrapper for libdeflate.
What it is and what it does
deflate is a thin Python binding to Eric Biggers' libdeflate C library, exposing compression and decompression for gzip, raw DEFLATE, and zlib formats. It also provides CRC32 and Adler-32 checksum functions. The package is built as a compiled extension with pre-compiled wheels for common platforms, so installation typically requires no build step.
You use it when you need faster compression than Python's built-in zlib module, or when you want to work with raw DEFLATE or zlib data streams where the original decompressed size must be tracked separately. The API is minimal: functions like gzip_compress, deflate_decompress, and crc32 take byte strings and optional parameters (compression level, initial checksum state) and return the result directly.
Use it for:
- Compress large text or binary payloads for network transmission or storage when speed matters more than standard library zlib.
- Decompress gzip or zlib data received from external sources with a simpler API than the standard library.
- Compute rolling CRC32 or Adler-32 checksums across multiple data chunks for integrity verification.
- Work with raw DEFLATE streams where you manage the original size separately, as required by some protocols.
- Replace zlib in performance-critical paths where libdeflate's faster implementation reduces CPU overhead.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Thin Python wrapper around libdeflate for fast gzip, DEFLATE, and zlib compression/decompression, plus CRC32 and Adler-32 checksum computation.
Yes, if you need faster compression/decompression than the standard library and are comfortable with a compiled dependency. The package is actively maintained, has no known vulnerabilities, and offers pre-compiled wheels for most platforms. Install friction is medium but manageable. Not necessary if standard library zlib meets your performance needs.
Install
deflate on PyPI
pip
pip install deflateuv
uv add deflatepoetry
poetry add deflateInstalling deflate
Before you install
Pre-compiled wheels available for common platforms (macOS, Linux, Windows, multiple architectures). Medium install friction due to compiled C extension, but wheels reduce build overhead. Active maintenance with last commit 2026-08-01.
License in practice
MIT license (permissive); you can use this freely in commercial and private projects with minimal restrictions.
Quickstart
pip install deflate
import deflate
compressed = deflate.gzip_compress(b"hello world!" * 1000, level=6)
original = deflate.gzip_decompress(compressed)
Requires Python 3.9 or later. Pre-compiled wheels available; building from source requires a C compiler and optionally LIBDEFLATE_PREFIX environment variable if linking to system libdeflate.
Verify before relying
- Performance comparison with standard library zlib or other compression libraries to justify adoption.
- Whether the compression level range (1-12 for libdeflate) offers practical benefits over standard zlib (1-9).
- API stability and backward compatibility guarantees across future releases.
Package facts
| License | not declared (permissive) |
| Python support | supports the current Python release (>=3.9) |
| Install friction | medium — platform-specific wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 392 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 331,744/month — #7,512 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: deflate-0.8.1-cp310-cp310-macosx_10_9_x86_64.whl; deflate-0.8.1-cp310-cp310-macosx_11_0_arm64.whl; deflate-0.8.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl; deflate-0.8.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl; deflate-0.8.1-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl; deflate-0.8.1-cp310-cp310-musllinux_1_2_aarch64.whl; deflate-0.8.1-cp310-cp310-musllinux_1_2_i686.whl; deflate-0.8.1-cp310-cp310-musllinux_1_2_x86_64.whl; deflate-0.8.1-cp310-cp310-win32.whl; deflate-0.8.1-cp310-cp310-win_amd64.whl; deflate-0.8.1-cp311-abi3-macosx_10_9_x86_64.whl; deflate-0.8.1-cp311-abi3-macosx_11_0_arm64.whl; deflate-0.8.1-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl; deflate-0.8.1-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl; deflate-0.8.1-cp311-abi3-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl; deflate-0.8.1-cp311-abi3-musllinux_1_2_aarch64.whl; deflate-0.8.1-cp311-abi3-musllinux_1_2_i686.whl; deflate-0.8.1-cp311-abi3-musllinux_1_2_x86_64.whl; deflate-0.8.1-cp311-abi3-win32.whl; deflate-0.8.1-cp311-abi3-win_amd64.whl
Tags
More Libraries packages
urllib3 is an HTTP client library that provides…
permissive · top 100 on PyPI
requestsRequests is a Python HTTP library that…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
python-dateutilProvides parsing, arithmetic, and recurrence…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
pytestpytest is a testing framework that lets you…
permissive · top 100 on PyPI
malduckMalduck provides cryptographic, compression,…
copyleft · top 15,000 on PyPI
zlib-ngProvides faster zlib and gzip compression and…
permissive · top 5,000 on PyPI
zlib-stateProvides low-level access to zlib decompression…
permissive · top 15,000 on PyPI
cramjamProvides fast Python bindings to multiple…
permissive · top 1,000 on PyPI
compress-pickleWraps Python's standard pickle serialization…
permissive · top 15,000 on PyPI
stream-inflateDecompresses DEFLATE and DEFLATE64 streams in…
permissive · top 5,000 on PyPI
zopfliZopfli is a Python binding for Google's Zopfli…
permissive · top 1,000 on PyPI
inflate64Provides Deflater and Inflater classes to…
copyleft · top 5,000 on PyPI
binapyBinaPy wraps Python's binary-handling libraries…
permissive · top 5,000 on PyPI
bloscPython wrapper for the Blosc compression…
permissive · top 15,000 on PyPI