lz4
LZ4 Bindings for Python
Decision gist · record as of 2026-08-14
Yes. python-lz4 is production-stable, actively maintained, carries no known vulnerabilities, and offers a standard library-compatible API for LZ4 compression. Install friction is moderate due to C extensions, but prebuilt wheels cover all major platforms and Python versions. Choose it when you need LZ4's speed or when interoperating with systems already using LZ4.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.9 or later; C compiler needed if building from source rather than using prebuilt wheels.
- Medium install friction due to compiled C extensions, but prebuilt wheels are available for Python 3.9–3.13 across macOS, Linux, and Windows platforms.
- Actively maintained with recent commits and no known vulnerabilities.
License · maintenance · safety
permissive license (permissive) — Covered by BSD 3-Clause License (permissive), allowing commercial and private use with minimal restrictions.
last release 2025-11-03 (284 days) · last repo commit 2026-06-22 · 304 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 104,845,718 downloads/mo, #331 on PyPI
Alternatives
Verify before relying
pip install lz4
import lz4.frame
compressed = lz4.frame.compress(b'data to compress')
decompressed = lz4.frame.decompress(compressed)- Performance characteristics compared to standard library compression modules in typical workloads.
- Whether experimental streaming format bindings are production-ready or should be avoided.
- Specific thread-safety guarantees and GIL behavior under concurrent load.
What it is and what it does
python-lz4 wraps the LZ4 compression library, exposing its frame and block format specifications through a Python API modeled after the standard library's zlib, gzip, bzip2, and lzma modules. This design makes it a potential drop-in replacement for existing compression code. The bindings release the GIL when calling into the underlying C library, making them suitable for threaded applications. Frame format is the recommended interface for interoperability with other LZ4 implementations; block and experimental streaming formats are also available.
The package has been in active development since 2012, supports Python 3.9 through 3.13, and includes prebuilt wheels for common platforms. It provides context managers and file handler support, matching the ergonomics of Python's built-in compression modules. An extensive test suite is included, and documentation is hosted on readthedocs.
Use it for
- Replace zlib or gzip in existing code when faster compression speed is needed over compression ratio.
- Compress data in network protocols or storage systems that already use LZ4 elsewhere in the stack.
- Compress large datasets in multithreaded applications where GIL contention is a concern.
- Implement frame-format LZ4 compression for cross-language interoperability.
- Add compression to file I/O operations using the provided file handler support.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
python-lz4 is production-stable, actively maintained, carries no known vulnerabilities, and offers a standard library-compatible API for LZ4 compression. Install friction is moderate due to C extensions, but prebuilt wheels cover all major platforms and Python versions. Choose it when you need LZ4's speed or when interoperating with systems already using LZ4.
Install
lz4 on PyPI
Before you install
Medium install friction due to compiled C extensions, but prebuilt wheels are available for Python 3.9–3.13 across macOS, Linux, and Windows platforms. Actively maintained with recent commits and no known vulnerabilities.
Requires Python 3.9 or later; C compiler needed if building from source rather than using prebuilt wheels.
License in practice
Covered by BSD 3-Clause License (permissive), allowing commercial and private use with minimal restrictions.
Quickstart
pip install lz4
import lz4.frame
compressed = lz4.frame.compress(b'data to compress')
decompressed = lz4.frame.decompress(compressed)
Verify before relying
- Performance characteristics compared to standard library compression modules in typical workloads.
- Whether experimental streaming format bindings are production-ready or should be avoided.
- Specific thread-safety guarantees and GIL behavior under concurrent load.
Package facts
| License | permissive license permissive |
| Python support | Supports the current Python release >=3.9 |
| Install friction | Medium. Platform-specific wheel |
| Runtime dependencies | None |
| Maintenance | Actively maintained 284 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 104,845,718 / month, #331 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/StableIntended Audience :: DevelopersLicense :: OSI Approved :: BSD LicenseProgramming Language :: CProgramming Language :: PythonProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.9 |
Evidence: lz4-4.4.5-cp310-cp310-macosx_10_9_x86_64.whl; lz4-4.4.5-cp310-cp310-macosx_11_0_arm64.whl; lz4-4.4.5-cp310-cp310-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl; lz4-4.4.5-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl; lz4-4.4.5-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl; lz4-4.4.5-cp310-cp310-win32.whl; lz4-4.4.5-cp310-cp310-win_amd64.whl; lz4-4.4.5-cp310-cp310-win_arm64.whl; lz4-4.4.5-cp311-cp311-macosx_10_9_x86_64.whl; lz4-4.4.5-cp311-cp311-macosx_11_0_arm64.whl; lz4-4.4.5-cp311-cp311-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl; lz4-4.4.5-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl; lz4-4.4.5-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl; lz4-4.4.5-cp311-cp311-win32.whl; lz4-4.4.5-cp311-cp311-win_amd64.whl; lz4-4.4.5-cp311-cp311-win_arm64.whl; lz4-4.4.5-cp312-cp312-macosx_10_13_x86_64.whl; lz4-4.4.5-cp312-cp312-macosx_11_0_arm64.whl; lz4-4.4.5-cp312-cp312-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl; lz4-4.4.5-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.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 › “lz4 compression python”
- lz4Python bindings for the LZ4 compression library, providing frame and…
- hdf5pluginRegisters HDF5 compression filters (Blosc, Blosc2, BitShuffle, BZip2,…
- dissect.utilProvides utility functions and decompression algorithms (LZ4, LZO)…
Give your agent the search over MCP, or paste the wish link into any chat.
Similar packages
Provides Python bindings to the Zstandard (zstd) compression library with an API similar to bz2, lzma, and zlib modules.
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.
Install only if your workload is actually bottlenecked on compression—the standard library zlib is sufficient for most use cases.
pybcj provides Python bindings to a BCJ (Branch-Call-Jump) filter implementation for preprocessing executable binaries before compression, improving compression ratios when used with LZMA compressors.
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.
Wraps Python's standard pickle serialization with transparent compression using gzip, bz2, lzma, zipfile, or optionally lz4, reducing storage size for pickled objects.
Install only if your use case is stable and you do not expect future Python or compression library changes to break it.
Provides fast Python bindings to multiple compression and decompression algorithms (Snappy, Brotli, Bzip2, Lz4, Gzip, Zlib, Deflate, ZSTD, XZ) implemented in Rust, with no system or Python dependencies required.
See also bz2file · apple-compress · hdf5plugin · isal