pyliblzfse
raw JSON → 0.4.1 verified Fri May 01 auth: no python maintenance
pyliblzfse provides Python bindings for the LZFSE reference implementation, offering compression and decompression using Apple's LZFSE algorithm. Version 0.4.1 is the latest release. The library is in maintenance mode with sparse updates.
pip install pyliblzfse Common errors
error ImportError: No module named 'pyliblzfse' ↓
cause Package not installed or installed in wrong environment.
fix
Install with 'pip install pyliblzfse' and ensure virtual environment is activated.
error TypeError: a bytes-like object is required, not 'str' ↓
cause Passing a string to compress() instead of bytes.
fix
Convert string to bytes: compress(data.encode())
error ValueError: data is not valid LZFSE compressed data ↓
cause Decompressing data that is not LZFSE compressed.
fix
Ensure the data was compressed with compress() from this library, or verify input.
Warnings
gotcha compress() and decompress() expect bytes, not strings. Passing str will raise TypeError. ↓
fix Always encode strings to bytes before calling compress, e.g., b'text' or 'text'.encode()
deprecated Library updates are infrequent; may not support newer Python versions. Last release 2018. ↓
fix Consider alternatives like pyLZFSE or using ctypes bindings for newer Python.
gotcha Compression output may be larger than input for small data. LZFSE is optimized for larger blocks. ↓
fix Do not assume compression ratio for small inputs; use with large data or benchmark.
Imports
- compress wrong
from liblzfse import compresscorrectfrom pyliblzfse import compress - decompress
from pyliblzfse import decompress
Quickstart
from pyliblzfse import compress, decompress
original = b"Hello, world!" * 1000
compressed = compress(original)
decompressed = decompress(compressed)
assert original == decompressed
print("LZFSE compression works!")