Skip to main content

pigz - python bindings to pigz (parallel gzip)

Project description

pigz

2.8 (19 Aug 2022) by Mark Adler

pigz, which stands for Parallel Implementation of GZip, is a fully functional replacement for gzip that exploits multiple processors and multiple cores to the hilt when compressing data.

pigz was written by Mark Adler and does not include third-party code. I am making my contributions to and distributions of this project solely in my personal capacity, and am not conveying any rights to any intellectual property of any third parties.

This version of pigz is written to be portable across Unix-style operating systems that provide the zlib and pthread libraries.

Type "make" in this directory to build the "pigz" executable. You can then install the executable wherever you like in your path (e.g. /usr/local/bin/). Type "pigz" to see the command help and all of the command options.

The latest version of pigz can be found at http://zlib.net/pigz/ . You need zlib version 1.2.3 or later to compile pigz. zlib version 1.2.6 or later is recommended, which reduces the overhead between blocks. You can find the latest version of zlib at http://zlib.net/ . You can look in pigz.c for the change history.

Questions, comments, bug reports, fixes, etc. can be emailed to Mark at his address in the license below.

The license from pigz.c is copied here:

This software is provided 'as-is', without any express or implied warranty. In no event will the author be held liable for any damages arising from the use of this software.

Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:

  1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
  2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
  3. This notice may not be removed or altered from any source distribution.

Mark Adler madler@alumni.caltech.edu

Python Bindings

Python Bindings are powered by Pybind11 and the source code is available at https://github.com/thammegowda/pigz.

Install pigz

# Option 1: from PyPI
pip install pigz

# Option 2: from source code
pip install git+https://github.com/thammegowda/pigz

Features

  1. Drop-in replacement for built in gzip (Aiming to be. Currently WIP)
  2. Handles context managers. Automatically opens and closes files when used correctly with with block

Limitations

  1. Python APIs are currently tailored for text mode
  2. Maybe unstable on some platforms. Tested on GNU/Linux for now.

Usage

import pigz

data = "Hello, World!\nThis is a test\nThis is the third line"
out_path = 'test_iterator.gz'

# How to write data
with pigz.open(str(out_path), 'wt') as f:
   f.write(data)

# How to read data
with pigz.open(str(out_path), 'rt') as f:
   data2 = ''
   for line in f:
      data2 += line
assert data == data2

See tests/ directory for some more examples

Run Tests for Python Module

cmake -B build
cmake --build build
python -m pytest -vs tests/

Build Wheels for Release

NOTE: this for developers only

Many Linux Wheels

Build produces *-linux_x86_64.whl wheels but they are not readily portable. We need to convert them into portable manylinux*.whl files, which requires building on older toolchain (glibc)

Docs: https://github.com/pypa/manylinux

docker run -it -v $(pwd):/work quay.io/pypa/manylinux2014_x86_64 bash
cd /work  #go to the dir where pigz code is mounted

# build wheel for all supported python versions
for v in 3.{8..13}; do p=$(dirname $(realpath $(which python$v))); echo "rm -rf build; PATH=$p:$PATH python$v -m build -w"; done | bash
# python$v-config bin is required but it was unavailable in the default PATH, hence $p is added to enable python$v-config

# wheels are stored here
ls -lh dist/

# convert wheels to manylinux wheels
auditwheel repair dist/*.whl -w dist/wheelhouse


# Upload
# exit docker env
twine upload -r pypi dist/wheelhouse/*.whl

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

pigz-2.9rc2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (163.9 kB view details)

Uploaded CPython 3.13 manylinux: glibc 2.17+ x86-64

pigz-2.9rc2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (163.9 kB view details)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64

pigz-2.9rc2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (163.9 kB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

pigz-2.9rc2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (163.9 kB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

pigz-2.9rc2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (163.9 kB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

pigz-2.9rc2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (163.9 kB view details)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

File details

Details for the file pigz-2.9rc2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pigz-2.9rc2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ef75f93065bfa21e31a4569caa23143cc0616a12fe563d849b1968413431a551
MD5 2dd2271b46daa4963e9b795b27f3ec55
BLAKE2b-256 e8d46d5b8f08d471f62bc17f274b7e5795e14f86621d36280b8521ff35360663

See more details on using hashes here.

File details

Details for the file pigz-2.9rc2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pigz-2.9rc2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 21747ed80033e06e176e48309738af38227f38dd332681c2f5f06855c7a4a411
MD5 18e65ff0d3adee350c99e51b2fd09f5b
BLAKE2b-256 540288330796f05576f740c0d572a8f95401b59de3f96c987c5d881aefba1e75

See more details on using hashes here.

File details

Details for the file pigz-2.9rc2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pigz-2.9rc2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 030d9f4986a414715045c1989bd3ceb8f9620649acae40a6576c58d3bfdf677b
MD5 a183ec85df5934d889a7006fbd3163f7
BLAKE2b-256 46be40c683793ff88fcbc851de12440c378c49cef495bf9b4a32e917a8c9d79e

See more details on using hashes here.

File details

Details for the file pigz-2.9rc2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pigz-2.9rc2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 075fbbca2e6d83f0aa79abd15d71d1258ebb7c46fec02c44fe565fa28a103629
MD5 ada6409701613e7177633005af9912f0
BLAKE2b-256 1c3b2917f82d2600330755d0fa9d83cee19ce7b02c77658c04660bfdc0a2019e

See more details on using hashes here.

File details

Details for the file pigz-2.9rc2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pigz-2.9rc2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 033ed161f6beb3b7a211cf8da0d8fcc011bb8258cef6041df2fe109e6feed832
MD5 572412ecf59f9925fa3009b806deee84
BLAKE2b-256 cf3adc8aaf0d16daeea812e79e3e510e6f4076a0ddc4709fa7b8dab870923921

See more details on using hashes here.

File details

Details for the file pigz-2.9rc2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pigz-2.9rc2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 88489c603d34e7d3533e29743747ef0b08ce82f111ee8824fc739df0b11b67b0
MD5 033bafb253b4d82fb9903864542c6d03
BLAKE2b-256 903f44532cf262d001402bac9d12d6135ed8af4e03856ef86877c860f4589630

See more details on using hashes here.

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