isal
isal (python-isal) provides faster zlib and gzip compatible compression and decompression by offering Python bindings for the Intel® Intelligent Storage Acceleration Library (ISA-L). It includes `isal_zlib` and `igzip` as high-performance, largely drop-in replacements for the standard library's `zlib` and `gzip` modules, respectively, along with `igzip_threaded` for multi-threaded streaming and `igzip_lib` for direct ISA-L API access. The current version is 1.8.0, and it maintains an active development and release cadence.
Warnings
- breaking As of a recent release (likely 1.8.0), Python 3.8 and 3.9 are no longer officially supported, despite PyPI metadata potentially indicating support for `>=3.9`.
- gotcha Compression level `0` in `isal_zlib` and `igzip` corresponds to the *lowest* compression level, unlike `zlib` and `gzip` where `0` means 'no compression'.
- gotcha `isal_zlib` primarily supports `Z_DEFAULT_STRATEGY`. While other strategies are exposed for compatibility, using them may result in warnings as ISA-L might not fully implement them.
- gotcha `igzip_threaded`'s `open` function returns buffered read/write streams that are designed for streaming only and do not support seeking operations.
- gotcha `igzip.open` returns an `IGzipFile` class instance, not the standard `GzipFile`. While `igzip.GzipFile` exists as an alias for compatibility, direct type checking or relying on `GzipFile`-specific internal behavior might break.
Install
-
pip install isal -
conda install python-isal
Imports
- isal_zlib
from isal import isal_zlib
- igzip
from isal import igzip
- igzip_threaded
from isal import igzip_threaded
- igzip_lib
from isal import igzip_lib
Quickstart
from isal import isal_zlib
original_data = b"Python-isal offers faster compression and decompression." * 10
# Compress data
compressed_data = isal_zlib.compress(original_data)
# Decompress data
decompressed_data = isal_zlib.decompress(compressed_data)
assert original_data == decompressed_data
print(f"Original size: {len(original_data)} bytes")
print(f"Compressed size: {len(compressed_data)} bytes")
print("Data compressed and decompressed successfully using isal_zlib.")