zlib-ng
Drop-in replacement for zlib and gzip modules using zlib-ng
Decision gist · record as of 2026-08-14
Yes, if you need faster compression/decompression and can tolerate medium install friction (compiled wheels). The package is actively maintained, has no known vulnerabilities, is permissively licensed, and offers a true drop-in replacement API. Install only if your workload is actually bottlenecked on compression—the standard library zlib is sufficient for most use cases.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.9 or later; platform-specific wheels may not be available for all architectures.
- Medium install friction due to compiled C extensions requiring platform-specific wheels.
- Wheels are available for common platforms (Linux x86_64/aarch64, macOS x86_64/arm64, Windows x64) across Python 3.10–3.12, with active maintenance and no runtime dependencies.
License · maintenance · safety
PSF-2.0 (permissive) — Licensed under PSF-2.0 (permissive), allowing use in most projects without significant restrictions.
last release 2025-09-10 (338 days) · last repo commit 2026-07-03 · 15 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 1,761,783 downloads/mo, #3,582 on PyPI
Alternatives
Verify before relying
pip install zlib-ng
from zlib_ng import zlib_ng
compressed = zlib_ng.compress(b'data')
decompressed = zlib_ng.decompress(compressed)- Actual performance improvement magnitude compared to standard library zlib across different workloads and compression levels.
- Full compatibility surface with standard library zlib and gzip beyond the documented minor differences.
- Support status for Python 3.13 and 3.14 (listed in classifiers but not in wheel evidence).
What it is and what it does
zlib-ng wraps the zlib-ng C library to provide faster compression and decompression than Python's built-in zlib and gzip modules. It offers three modules: zlib_ng (a zlib replacement), gzip_ng (a gzip replacement), and gzip_ng_threaded (which adds multi-threaded streaming for large files). All three are designed to be nearly drop-in replacements for their standard library counterparts, with the same API and behavior—the main difference is speed. The package includes a command-line tool (python -m zlib_ng.gzip_ng) that mimics the standard gzip utility.
The package is built from C extensions and requires compilation or platform-specific wheels during installation. It supports Linux, macOS, and Windows across multiple architectures. There are minor differences from the standard library: compression level 1 produces worse compression ratios than standard zlib, and gzip_ng.open returns GzipNGFile instead of GzipFile (though GzipFile is aliased for compatibility). No runtime dependencies are required once installed.
Use it for
- Replace zlib in data processing pipelines where compression speed is a bottleneck and standard library performance is insufficient.
- Accelerate gzip-based file I/O in applications that read or write many compressed files.
- Stream large compressed files using gzip_ng_threaded to parallelize I/O and escape Python's GIL.
- Implement gzip-compatible command-line compression tools with better performance than the standard gzip utility.
- Reduce latency in HTTP compression workflows where zlib is the bottleneck in request/response handling.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you need faster compression/decompression and can tolerate medium install friction (compiled wheels).
The package is actively maintained, has no known vulnerabilities, is permissively licensed, and offers a true drop-in replacement API. Install only if your workload is actually bottlenecked on compression—the standard library zlib is sufficient for most use cases.
Install
zlib-ng on PyPI
Before you install
Medium install friction due to compiled C extensions requiring platform-specific wheels. Wheels are available for common platforms (Linux x86_64/aarch64, macOS x86_64/arm64, Windows x64) across Python 3.10–3.12, with active maintenance and no runtime dependencies.
Requires Python 3.9 or later; platform-specific wheels may not be available for all architectures.
License in practice
Licensed under PSF-2.0 (permissive), allowing use in most projects without significant restrictions.
Quickstart
pip install zlib-ng
from zlib_ng import zlib_ng
compressed = zlib_ng.compress(b'data')
decompressed = zlib_ng.decompress(compressed)
Verify before relying
- Actual performance improvement magnitude compared to standard library zlib across different workloads and compression levels.
- Full compatibility surface with standard library zlib and gzip beyond the documented minor differences.
- Support status for Python 3.13 and 3.14 (listed in classifiers but not in wheel evidence).
Package facts
| License | PSF-2.0 permissive |
| Python support | Supports the current Python release >=3.9 |
| Install friction | Medium. Platform-specific wheel |
| Runtime dependencies | None |
| Maintenance | Actively maintained 338 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 1,761,783 / month, #3,582 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableOperating System :: MacOSOperating System :: Microsoft :: WindowsOperating System :: POSIX :: LinuxProgramming Language :: CProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: System :: Archiving :: Compression |
Evidence: zlib_ng-1.0.0-cp310-cp310-macosx_10_9_x86_64.whl; zlib_ng-1.0.0-cp310-cp310-macosx_11_0_arm64.whl; zlib_ng-1.0.0-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl; zlib_ng-1.0.0-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl; zlib_ng-1.0.0-cp310-cp310-musllinux_1_2_aarch64.whl; zlib_ng-1.0.0-cp310-cp310-musllinux_1_2_x86_64.whl; zlib_ng-1.0.0-cp310-cp310-win_amd64.whl; zlib_ng-1.0.0-cp311-cp311-macosx_10_9_x86_64.whl; zlib_ng-1.0.0-cp311-cp311-macosx_11_0_arm64.whl; zlib_ng-1.0.0-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl; zlib_ng-1.0.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl; zlib_ng-1.0.0-cp311-cp311-musllinux_1_2_aarch64.whl; zlib_ng-1.0.0-cp311-cp311-musllinux_1_2_x86_64.whl; zlib_ng-1.0.0-cp311-cp311-win_amd64.whl; zlib_ng-1.0.0-cp312-cp312-macosx_10_13_x86_64.whl; zlib_ng-1.0.0-cp312-cp312-macosx_11_0_arm64.whl; zlib_ng-1.0.0-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl; zlib_ng-1.0.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl; zlib_ng-1.0.0-cp312-cp312-musllinux_1_2_aarch64.whl; zlib_ng-1.0.0-cp312-cp312-musllinux_1_2_x86_64.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “fast zlib compression”
- zlib-ngProvides faster zlib and gzip compression and decompression by…
- deflateThin Python wrapper around libdeflate for fast gzip, DEFLATE, and…
- isalProvides Python bindings for Intel's ISA-L library to accelerate zlib…
Give your agent the search over MCP, or paste the wish link into any chat.
More Compression packages
Provides Python bindings to the Brotli compression library, enabling lossless compression and decompression using a modern LZ77 variant with Huffman coding and context modeling.
Install it if you need Brotli compression in Python; the API is straightforward and the library is battle-tested.
Provides Zstandard compression support for Python versions before 3.14, backporting the standard library's zstd module along with zstd-enabled tarfile and zipfile modules.
Zopfli is a Python binding for Google's Zopfli compression library, providing higher-density compression for zlib and gzip formats than standard algorithms, with tunable iteration and block-splitting parameters.
Python binding for Google's Snappy compression library, providing fast compression and decompression of data via the cramjam backend.
However, dormant maintenance (715 days since last release) means security or compatibility issues may not be addressed quickly.
pyzipper replaces Python's standard zipfile module to read and write AES-encrypted zip archives, using the WinZip AES encryption specification.
Provides Python bindings to the Zstandard (zstd) compression library with an API similar to bz2, lzma, and zlib modules.
See also aiohttp-zlib-ng · deflate · isal · zlib-state · lz4 · aiohttp-fast-zlib · bz2file · cmeel-zlib · mgzip