python-lzf
raw JSON → 0.2.6 verified Mon Apr 27 auth: no python abandoned
Python C extension for the LZF compression algorithm, providing fast compression/decompression. Current version 0.2.6, last updated in 2013 (abandoned). Offers a simple API with compress and decompress functions. Best for small data or where LZF speed is needed.
pip install python-lzf Common errors
error ImportError: No module named lzf ↓
cause Library not installed or Python cannot find it.
fix
Run pip install python-lzf, or install from source if not on PyPI.
error ImportError: liblzf.so.1: cannot open shared object file ↓
cause Missing liblzf system library.
fix
Install liblzf via system package manager (e.g., apt-get install liblzf-dev on Debian/Ubuntu).
Warnings
gotcha Library is abandoned; no updates since 2013. May break on newer Python versions (e.g., Python 3.12+). ↓
fix Consider alternatives like lz4, zstandard, or python-blosc.
gotcha Compresses only bytes, not strings. Passing str will raise TypeError. ↓
fix Encode strings to bytes first: data.encode('utf-8').
Imports
- lzf
import lzf
Quickstart
import lzf
data = b'Hello, World! * 100'
compressed = lzf.compress(data)
decompressed = lzf.decompress(compressed)
print('OK' if data == decompressed else 'FAIL')