Faster zlib and gzip compatible compression and decompression by providing Python bindings for the ISA-L library.
This package provides Python bindings for the ISA-L library. The Intel(R) Intelligent Storage Acceleration Library (ISA-L) implements several key algorithms in assembly language. This includes a variety of functions to provide zlib/gzip-compatible compression.
python-isal provides the bindings by offering an isal_zlib and
igzip module which are usable as drop-in replacements for the zlib
and gzip modules from the stdlib (with some minor exceptions, see below).
Python-isal has faster versions of the stdlib's zlib and gzip module
these are called isal_zlib and igzip respectively.
They can be imported as follows
from isal import isal_zlib
from isal import igzipisal_zlib and igzip are meant to be used as drop in replacements so
their api and functions are the same as the stdlib's modules. Except where
ISA-L does not support the same calls as zlib (See differences below).
A full API documentation can be found on our readthedocs page.
python -m isal.igzip implements a simple gzip-like command line
application (just like python -m gzip).
- with pip:
pip install isal - with conda:
conda install python-isal
Installation is supported on Linux, Windows and MacOS. For more advanced installation options check the documentation.
- Compression level 0 in
zlibandgzipmeans no compression, while inisal_zlibandigzipthis is the lowest compression level. This is a design choice that was inherited from the ISA-L library. - Compression levels range from 0 to 3, not 1 to 9.
isal_zlib.Z_DEFAULT_COMPRESSIONhas been aliased toisal_zlib.ISAL_DEFAULT_COMPRESSION(2). isal_zlibonly supportsNO_FLUSH,SYNC_FLUSH,FULL_FLUSHandFINISH_FLUSH. Other flush modes are not supported and will raise errors.zlib.Z_DEFAULT_STRATEGY,zlib.Z_RLEetc. are exposed asisal_zlib.Z_DEFAULT_STRATEGY,isal_zlib.Z_RLEetc. for compatibility reasons. However,isal_zlibonly supports a default strategy and will give warnings when other strategies are used.zlibsupports different memory levels from 1 to 9 (with 8 default).isal_zlibsupports memory levels smallest, small, medium, large and largest. These have been mapped to levels 1, 2-3, 4-6, 7-8 and 9. Soisal_zlibcan be used with zlib compatible memory levels.isal_zlibmethods have adataargument which is positional only. In isal_zlib this is not enforced and it can also called as keyword argument. This is due to implementingisal_zlibin cython and maintaining backwards compatibility with python 3.6.igzip.openreturns a classIGzipFileinstead ofGzipFile. Since the compression levels are not compatible, a difference in naming was chosen to reflect this.igzip.GzipFiledoes exist as an alias ofigzip.IGzipFilefor compatibility reasons.
Please make a PR or issue if you feel anything can be improved. Bug reports are also very welcome. Please report them on the github issue tracker.