Skip to main content

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(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 four modules:

  • isal_zlib: A drop-in replacement for the zlib module that uses ISA-L to accelerate its performance.

  • igzip: A drop-in replacement for the gzip module that uses isal_zlib instead of zlib to perform its compression and checksum tasks, which improves performance.

  • igzip_threaded offers an open function which returns buffered read or write streams that can be used to read and write large files while escaping the GIL using one or multiple threads. This functionality only works for streaming, seeking is not supported.

  • igzip_lib: Provides compression functions which have full access to the API of ISA-L’s compression functions.

isal_zlib and igzip are almost fully compatible with zlib and gzip from the Python standard library. There are some minor differences see: differences-with-zlib-and-gzip-modules.

Quickstart

The python-isal modules can be imported as follows

from isal import isal_zlib
from isal import igzip
from isal import igzip_lib

isal_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). Full usage documentation can be found on our readthedocs page.

Installation

  • 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.

python-isal as a dependency in your project

Python-isal supports a limited amount of platforms for which wheels have been made available. To prevent your users from running into issues when installing your project please list a python-isal dependency as follows.

setup.cfg:

install_requires =
    isal; platform.machine == "x86_64" or platform.machine == "AMD64" or platform.machine == "aarch64"

setup.py:

extras_require={
    ":platform.machine == 'x86_64' or platform.machine == 'AMD64' or platform.machine == 'aarch64'": ['isal']
},

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.Z_DEFAULT_COMPRESSION has been aliased to isal_zlib.ISAL_DEFAULT_COMPRESSION (2).

  • isal_zlib only supports NO_FLUSH, SYNC_FLUSH, FULL_FLUSH and FINISH_FLUSH. Other flush modes are not supported and will raise errors.

  • 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.

  • igzip.open returns a class IGzipFile instead of GzipFile. Since the compression levels are not compatible, a difference in naming was chosen to reflect this. igzip.GzipFile does exist as an alias of igzip.IGzipFile for compatibility reasons.

  • igzip._GzipReader has been rewritten in C. Since this is a private member it should not affect compatibility, but it may cause some issues for instances where this code is used directly. If such issues should occur, please report them so the compatibility issues can be fixed.

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.

Acknowledgements

This project builds upon the software and experience of many. Many thanks to:

  • The ISA-L contributors for making ISA-L. Special thanks to @gbtucker for always being especially helpful and responsive.

  • The Cython contributors for making it easy to create an extension and helping a novice get start with pointer addresses.

  • The CPython contributors. Python-isal mimicks zlibmodule.c and gzip.py from the standard library to make it easier for python users to adopt it.

  • @marcelm for taking a chance on this project and make it a dependency for his xopen and by extension cutadapt projects. This gave python-isal its first users who used python-isal in production.

  • Mark Adler (@madler) for the excellent comments in his pigz code which made it very easy to replicate the behaviour for writing gzip with multiple threads using the threading and isal_zlib modules. Another thanks for his permissive license, which allowed the crc32_combine code to be included in the project. (ISA-L does not provide a crc32_combine function, unlike zlib.) And yet another thanks to Mark Adler and also for Jean-loup Gailly for creating the gzip format which is very heavily used in bioinformatics. Without that, I would have never written this library from which I have learned so much.

  • The github actions team for creating the actions CI service that enables building and testing on all three major operating systems.

  • @animalize for explaining how to test and build python-isal for ARM 64-bit platforms.

  • And last but not least: everyone who submitted a bug report or a feature request. These make the project better!

Python-isal would not have been possible without you!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

isal-1.6.1.tar.gz (774.3 kB view hashes)

Uploaded Source

Built Distributions

isal-1.6.1-pp310-pypy310_pp73-win_amd64.whl (202.0 kB view hashes)

Uploaded PyPy Windows x86-64

isal-1.6.1-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (255.4 kB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ x86-64

isal-1.6.1-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (231.2 kB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ ARM64

isal-1.6.1-pp310-pypy310_pp73-macosx_10_9_x86_64.whl (246.7 kB view hashes)

Uploaded PyPy macOS 10.9+ x86-64

isal-1.6.1-pp39-pypy39_pp73-win_amd64.whl (202.0 kB view hashes)

Uploaded PyPy Windows x86-64

isal-1.6.1-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (255.4 kB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ x86-64

isal-1.6.1-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (231.2 kB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ ARM64

isal-1.6.1-pp39-pypy39_pp73-macosx_10_9_x86_64.whl (246.7 kB view hashes)

Uploaded PyPy macOS 10.9+ x86-64

isal-1.6.1-pp38-pypy38_pp73-win_amd64.whl (202.0 kB view hashes)

Uploaded PyPy Windows x86-64

isal-1.6.1-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (255.4 kB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ x86-64

isal-1.6.1-pp38-pypy38_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (231.1 kB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ ARM64

isal-1.6.1-pp38-pypy38_pp73-macosx_10_9_x86_64.whl (246.7 kB view hashes)

Uploaded PyPy macOS 10.9+ x86-64

isal-1.6.1-cp312-cp312-win_amd64.whl (201.5 kB view hashes)

Uploaded CPython 3.12 Windows x86-64

isal-1.6.1-cp312-cp312-musllinux_1_1_x86_64.whl (262.0 kB view hashes)

Uploaded CPython 3.12 musllinux: musl 1.1+ x86-64

isal-1.6.1-cp312-cp312-musllinux_1_1_aarch64.whl (239.0 kB view hashes)

Uploaded CPython 3.12 musllinux: musl 1.1+ ARM64

isal-1.6.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (258.6 kB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64

isal-1.6.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (231.8 kB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.17+ ARM64

isal-1.6.1-cp312-cp312-macosx_10_9_x86_64.whl (246.1 kB view hashes)

Uploaded CPython 3.12 macOS 10.9+ x86-64

isal-1.6.1-cp311-cp311-win_amd64.whl (201.4 kB view hashes)

Uploaded CPython 3.11 Windows x86-64

isal-1.6.1-cp311-cp311-musllinux_1_1_x86_64.whl (261.7 kB view hashes)

Uploaded CPython 3.11 musllinux: musl 1.1+ x86-64

isal-1.6.1-cp311-cp311-musllinux_1_1_aarch64.whl (238.9 kB view hashes)

Uploaded CPython 3.11 musllinux: musl 1.1+ ARM64

isal-1.6.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (258.3 kB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

isal-1.6.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (231.7 kB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ ARM64

isal-1.6.1-cp311-cp311-macosx_10_9_x86_64.whl (246.1 kB view hashes)

Uploaded CPython 3.11 macOS 10.9+ x86-64

isal-1.6.1-cp310-cp310-win_amd64.whl (201.4 kB view hashes)

Uploaded CPython 3.10 Windows x86-64

isal-1.6.1-cp310-cp310-musllinux_1_1_x86_64.whl (261.7 kB view hashes)

Uploaded CPython 3.10 musllinux: musl 1.1+ x86-64

isal-1.6.1-cp310-cp310-musllinux_1_1_aarch64.whl (238.9 kB view hashes)

Uploaded CPython 3.10 musllinux: musl 1.1+ ARM64

isal-1.6.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (258.3 kB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

isal-1.6.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (231.7 kB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ ARM64

isal-1.6.1-cp310-cp310-macosx_10_9_x86_64.whl (246.1 kB view hashes)

Uploaded CPython 3.10 macOS 10.9+ x86-64

isal-1.6.1-cp39-cp39-win_amd64.whl (201.4 kB view hashes)

Uploaded CPython 3.9 Windows x86-64

isal-1.6.1-cp39-cp39-musllinux_1_1_x86_64.whl (261.7 kB view hashes)

Uploaded CPython 3.9 musllinux: musl 1.1+ x86-64

isal-1.6.1-cp39-cp39-musllinux_1_1_aarch64.whl (238.9 kB view hashes)

Uploaded CPython 3.9 musllinux: musl 1.1+ ARM64

isal-1.6.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (258.3 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

isal-1.6.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (231.7 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ ARM64

isal-1.6.1-cp39-cp39-macosx_10_9_x86_64.whl (246.1 kB view hashes)

Uploaded CPython 3.9 macOS 10.9+ x86-64

isal-1.6.1-cp38-cp38-win_amd64.whl (201.4 kB view hashes)

Uploaded CPython 3.8 Windows x86-64

isal-1.6.1-cp38-cp38-musllinux_1_1_x86_64.whl (261.8 kB view hashes)

Uploaded CPython 3.8 musllinux: musl 1.1+ x86-64

isal-1.6.1-cp38-cp38-musllinux_1_1_aarch64.whl (239.0 kB view hashes)

Uploaded CPython 3.8 musllinux: musl 1.1+ ARM64

isal-1.6.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (258.4 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

isal-1.6.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (231.8 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ ARM64

isal-1.6.1-cp38-cp38-macosx_10_9_x86_64.whl (246.1 kB view hashes)

Uploaded CPython 3.8 macOS 10.9+ x86-64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page