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.
pip install isalVerified import paths — ran on the pinned version, not inferred.
This example demonstrates basic compression and decompression using `isal_zlib`, highlighting its direct compatibility with the standard `zlib` module's API.
Ensure your project runs on Python 3.10 or newer.
Adjust compression level usage or explicitly choose a higher level if you expect actual compression.
Prefer `Z_DEFAULT_STRATEGY` or be aware that other strategies might behave differently or issue warnings.
Use `igzip` for files requiring seeking, or manage your data in a strictly streaming fashion with `igzip_threaded`.
When using `igzip.open`, avoid strict type checks against `gzip.GzipFile` or use `igzip.GzipFile` alias if specific compatibility is needed.
Install the necessary build dependencies for your operating system (e.g., `sudo apt-get install build-essential zlib1g-dev autoconf automake libtool` on Debian/Ubuntu, or corresponding development tools on other platforms) before running `pip install isal`.
First, ensure `isal` is installed via `pip install isal`. Then, correct the import statement to `from isal import isal_zlib` or `from isal import igzip` as per the library's structure.
When using `isal_zlib` or `igzip`, ensure you only use the explicitly supported flush modes: `isal_zlib.NO_FLUSH`, `isal_zlib.SYNC_FLUSH`, `isal_zlib.FULL_FLUSH`, or `isal_zlib.FINISH_FLUSH`.
Try updating the `isal` package to its latest version, as updates may address issues with ISA-L builds and file handling. Alternatively, pre-process the problematic gzip file to ensure it contains only a single valid gzip stream, for example, by decompressing and re-compressing it using standard `gzip` or `pigz`.