Skip to main content

Monkey patch the standard zipfile module to enable accelerated deflate via isal

Project description

zipfile-isal

PyPI

Monkey patch the standard zipfile module to enable accelerated deflate support via isal.

Based on zipfile-deflate64 and zipfile-zstandard, which provides similar functionality but for the deflate64 algorithm. Unlike zipfile-deflate64, this package supports both compression and decompression.

Requires isal (and slz optionally).

Note: if you need Python2, use zipfile39 instead (it is also compatible with Python3).

Installation

pip install zipfile-isal

Usage

Anywhere in a Python codebase:

import zipfile_isal  # This has the side effect of patching the zipfile module to support isal

Alternatively, zipfile_isal re-exports the zipfile API, as a convenience:

import zipfile_isal as zipfile

zipfile.ZipFile(...)

Compression example:

import zipfile_isal as zipfile

zf = zipfile.ZipFile('/tmp/test.zip', 'w', zipfile.ZIP_DEFLATED, compresslevel=-12)
zf.write('large_file.img')

compresslevel:

  • -10, -11, -12, -13 correspond to isal 0, 1, 2, 3
  • -21 corresponds to slz
  • 11 to 19 correspond to 7-zip 1-9

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

zipfile-isal-0.0.3.3.tar.gz (4.9 kB view hashes)

Uploaded source

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