lzallright - Python bindings for LZOKAY compression

raw JSON →
0.2.6 verified Sat May 09 auth: no python

A Python 3.8+ binding for the LZ👌(lzokay) compression library, providing compress and decompress functions with optional compression level. Version 0.2.6 adds experimental free-threading (nogil) support. Released every few months.

pip install lzallright
error ModuleNotFoundError: No module named 'lzallright'
cause Library not installed or installed in wrong environment.
fix
Run 'pip install lzallright' in the correct virtual environment.
error ValueError: compressed data truncated
cause Corrupt or incomplete compressed bytes passed to decompress().
fix
Verify compressed data integrity; ensure you pass the exact bytes returned by compress().
gotcha compress() returns bytes, not string. decompress() expects bytes.
fix Ensure input/output are bytes objects.
gotcha Compression level must be between 0 and 9 inclusive. Out-of-range values may raise ValueError.
fix Use level in range(0,10).
gotcha The library requires Rust toolchain to build from source (sdist). Binary wheels are available for many platforms but not all.
fix Install from PyPI binary wheel; if building from source, install Rust (rustc 1.66+).

Compress and decompress bytes with lzallright.

from lzallright import compress, decompress

original = b"Hello, world! " * 100
compressed = compress(original, level=6)
decompressed = decompress(compressed)
assert original == decompressed
print("Success!")