skillfed

deflate

Python wrapper for libdeflate.

deflate v0.8.1 331.7K downloads/30d#7,512 on PyPI33
Permissive license Active released

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 deflate

uv

uv add deflate

poetry

poetry add deflate

Installing 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

Development Status :: 4 - BetaIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: MacOS :: MacOS XOperating System :: Microsoft :: WindowsOperating System :: POSIX :: LinuxProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.9Topic :: Software Development :: LibrariesTopic :: System :: Archiving :: Compression

Tags

gzip compression decompressiondeflate compression libraryzlib wrapper pythoncrc32 adler32 checksumlibdeflate python bindingfast data compressiondeflate raw compression
compressionc-extensionchecksum

More Libraries packages