Faster zlib and gzip compatible compression and decompression by providing python bindings for the isa-l library.
Project description
python-isal
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 Infrastructure 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).
Installation
Installation with pip
Python-isal can be installed with:
pip install isal
This will include a staticallly linked version of isa-l. On Linux, wheels are provided. If a wheel is not provided for your system the installation will build ISA-L first in a temporary directory. Please check the ISA-L homepage for the build requirements.
The latest development version of python-isal can be installed with:
pip install git+https://github.com/rhpvorderman/python-isal.git
If you wish to link dynamically against a version of libisal installed on your system use:
PYTHON_ISAL_LINK_DYNAMIC=true pip install isal
ISA-L is available in numerous Linux distro’s as well as on conda via the conda-forge channel. Checkout the ports documentation on the ISA-L project wiki to find out how to install it. It is important that the development headers are also installed.
On Debian and Ubuntu the ISA-L libraries (including the development headers) can be installed with:
sudo apt install libisal-dev
Installation via conda
Python-isal can be installed via conda, for example using the miniconda installer with a properly setup conda-forge channel. When used with bioinformatics tools setting up bioconda provides a clear set of installation instructions for conda.
python-isal is available on conda-forge and can be installed with
conda install python-isal
This will automatically install the isa-l library dependency as well, since it is available on conda-forge.
Usage
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 igzip
isal_zlib and igzip were 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).
Differences with zlib and gzip modules
Compression level 0 in zlib and gzip means no compression, while in isal_zlib and igzip this 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.crc32 and isal_zlib.adler32 do not support negative numbers for the value parameter.
zlib.Z_DEFAULT_STRATEGY, zlib.Z_RLE etc. are exposed as isal_zlib.Z_DEFAULT_STRATEGY, isal_zlib.Z_RLE etc. for compatibility reasons. However, isal_zlib only supports a default strategy and will give warnings when other strategies are used.
zlib supports different memory levels from 1 to 9 (with 8 default). isal_zlib supports memory levels smallest, small, medium, large and largest. These have been mapped to levels 1, 2-3, 4-6, 7-8 and 9. So isal_zlib can be used with zlib compatible memory levels.
isal_zlib only supports FLUSH, SYNC_FLUSH and FULL_FLUSH FINISH is aliased to FULL_FLUSH (and works correctly as such).
isal_zlib has a compressobj and decompressobj implementation. However, the unused_data and unconsumed_tail for the Decompress object, only work properly when using gzip compatible compression. (25 <= wbits <= 31).
The flush implementation for the Compress object behavious differently from the zlib equivalent.
Contributing
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for isal-0.3.0-cp39-cp39-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d6fc5ca02222945148189513355674dfbd3ad70f83ed3bfdacd55e10b3bba649 |
|
MD5 | e6cacdafe92480298ba816fc7c3ba8f0 |
|
BLAKE2b-256 | dbae1c983e44aff1e3f6469f8a7b014a00c97568fe99d10ed2787e855e901e0c |
Hashes for isal-0.3.0-cp38-cp38-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0a3aa28b656e2c44f4f2f8333b3b6ee78ac26118972621fa29036b6f95056b96 |
|
MD5 | f9f0b4dc10e8e8a6fca1ec1bdc32e62b |
|
BLAKE2b-256 | 26e0279a4ed8cac6af100b96c856f07ff091dee4f0a0050b38c4f3fe167e7984 |
Hashes for isal-0.3.0-cp37-cp37m-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5af1f561c575304937370667a151e29aaad046f81e8568e4deb1e8dee399e623 |
|
MD5 | 19db1c9dc147dca0cd716425921614a7 |
|
BLAKE2b-256 | 170afe276ac052bb55c261d208311a6c31c7b00f299ee5e75441d5b70f80d921 |
Hashes for isal-0.3.0-cp36-cp36m-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e56391a1362ced5dc626855d84846701679dc375eb1c8dae7fd560b919d05fe9 |
|
MD5 | 93c452e388cfd8d41099225beb9f699d |
|
BLAKE2b-256 | 3bf723ec0cb488a5bd5a5f45925dc6ab17edd95e46911c62d1a1c58bfdccda20 |