--- id: zlib-ng version: "1.0.0" license: PSF-2.0 license_treatment: permissive maintenance: active --- # zlib-ng — Drop-in replacement for zlib and gzip modules using zlib-ng License: permissive · Maintenance: active · Downloads: 1.8M/mo ## 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 above — verify before relying. Provides faster zlib and gzip compression and decompression by wrapping the zlib-ng library with Python bindings that serve as drop-in replacements for the standard library modules. 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 pip install zlib-ng uv add zlib-ng poetry add zlib-ng ## Installing zlib-ng 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. 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) Requires Python 3.9 or later; platform-specific wheels may not be available for all architectures. 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_current - Install friction: medium - Maintenance: active - Downloads: 1.8M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags fast zlib compression, gzip performance replacement, zlib-ng python bindings, accelerated deflate compression, drop-in zlib replacement, compression, performance-optimization [View on SkillFed](https://skillfed.io/packages/zlib-ng) · [View on PyPI](https://pypi.org/project/zlib-ng/)