Skip to main content

Zopfli module for python

Project description

Build Status

PYZOPFLI

cPython bindings for zopfli.

It requires Python 3.10 or greater.

USAGE

pyzopfli is a straight forward wrapper around zopfli’s ZlibCompress method.

from zopfli.zlib import compress
from zlib import decompress
s = 'Hello World'
print decompress(compress(s))

pyzopfli also wraps GzipCompress, but the API point does not try to mimic the gzip module.

from zopfli.gzip import compress
from StringIO import StringIO
from gzip import GzipFile
print GzipFile(fileobj=StringIO(compress("Hello World!"))).read()

Both zopfli.zlib.compress and zopfli.gzip.compress support the following keyword arguments. All values should be integers; boolean parmaters are treated as expected, 0 and >0 as false and true.

  • verbose dumps zopfli debugging data to stderr

  • numiterations Maximum amount of times to rerun forward and backward pass to optimize LZ77 compression cost. Good values: 10, 15 for small files, 5 for files over several MB in size or it will be too slow.

  • blocksplitting If true, splits the data in multiple deflate blocks with optimal choice for the block boundaries. Block splitting gives better compression. Default: true (1).

  • blocksplittinglast If true, chooses the optimal block split points only after doing the iterative LZ77 compression. If false, chooses the block split points first, then does iterative LZ77 on each individual block. Depending on the file, either first or last gives the best compression. Default: false (0).

  • blocksplittingmax Maximum amount of blocks to split into (0 for unlimited, but this can give extreme results that hurt compression on some files). Default value: 15.

TODO

  • Stop reading the entire file into memory and support streaming

  • Monkey patch zlib and gzip so code with an overly tight binding can be easily modified to use zopfli.

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

zopfli-0.4.1.tar.gz (179.0 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

zopfli-0.4.1-pp311-pypy311_pp73-win_amd64.whl (102.2 kB view details)

Uploaded PyPyWindows x86-64

zopfli-0.4.1-pp311-pypy311_pp73-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl (124.4 kB view details)

Uploaded PyPymanylinux: glibc 2.24+ ARM64manylinux: glibc 2.28+ ARM64

zopfli-0.4.1-pp311-pypy311_pp73-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (127.3 kB view details)

Uploaded PyPymanylinux: glibc 2.17+ x86-64

zopfli-0.4.1-pp311-pypy311_pp73-macosx_10_15_x86_64.whl (147.1 kB view details)

Uploaded PyPymacOS 10.15+ x86-64

zopfli-0.4.1-cp310-abi3-win_amd64.whl (102.2 kB view details)

Uploaded CPython 3.10+Windows x86-64

zopfli-0.4.1-cp310-abi3-win32.whl (82.3 kB view details)

Uploaded CPython 3.10+Windows x86

zopfli-0.4.1-cp310-abi3-musllinux_1_2_x86_64.whl (1.9 MB view details)

Uploaded CPython 3.10+musllinux: musl 1.2+ x86-64

zopfli-0.4.1-cp310-abi3-musllinux_1_2_aarch64.whl (1.8 MB view details)

Uploaded CPython 3.10+musllinux: musl 1.2+ ARM64

zopfli-0.4.1-cp310-abi3-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl (818.5 kB view details)

Uploaded CPython 3.10+manylinux: glibc 2.24+ ARM64manylinux: glibc 2.28+ ARM64

zopfli-0.4.1-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (829.4 kB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ x86-64

zopfli-0.4.1-cp310-abi3-macosx_10_9_universal2.whl (291.6 kB view details)

Uploaded CPython 3.10+macOS 10.9+ universal2 (ARM64, x86-64)

File details

Details for the file zopfli-0.4.1.tar.gz.

File metadata

  • Download URL: zopfli-0.4.1.tar.gz
  • Upload date:
  • Size: 179.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for zopfli-0.4.1.tar.gz
Algorithm Hash digest
SHA256 07a5cdc5d1aaa6c288c5d9f5a5383042ba743641abf8e2fd898dcad622d8a38e
MD5 ea5d84d9e8c5d02e7835691667e0890d
BLAKE2b-256 0a4da8cc1768b2eda3c0c7470bf8059dcb94ef96d45dd91fc6edd29430d44072

See more details on using hashes here.

File details

Details for the file zopfli-0.4.1-pp311-pypy311_pp73-win_amd64.whl.

File metadata

File hashes

Hashes for zopfli-0.4.1-pp311-pypy311_pp73-win_amd64.whl
Algorithm Hash digest
SHA256 2f992ac7d83cbddd889e1813ace576cbc91a05d5d7a0a21b366e2e5f492e7707
MD5 73c7e3b7dbdb948b35737be2d33279bf
BLAKE2b-256 7b363c15d564db6dfdd740919b205bdb69be75113e9919c422cde658e6d013c0

See more details on using hashes here.

File details

Details for the file zopfli-0.4.1-pp311-pypy311_pp73-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for zopfli-0.4.1-pp311-pypy311_pp73-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 cb136a74d14a4ecfae29cb0fdecece58a6c115abc9a74c12bc6ac62e80f229d7
MD5 bc5d3b3884e071e73a8fb070d73cd185
BLAKE2b-256 23f0ad6e26aa06943ce9f1be4ae6738513a7b69d8ea1f3b13e46009a249a3f73

See more details on using hashes here.

File details

Details for the file zopfli-0.4.1-pp311-pypy311_pp73-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for zopfli-0.4.1-pp311-pypy311_pp73-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 a93c2ecafff372de6c0aa2212eff18a75f6c71a100372fee7b4b129cc0b6f9a7
MD5 c4e8d4fefd0d17e04c561a35b8e9a38a
BLAKE2b-256 452b0d9e4bdfd3d646a36b8516a01dec4ccd2967554603801e7c2d6c72fede3d

See more details on using hashes here.

File details

Details for the file zopfli-0.4.1-pp311-pypy311_pp73-macosx_10_15_x86_64.whl.

File metadata

File hashes

Hashes for zopfli-0.4.1-pp311-pypy311_pp73-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 02086247dd12fda929f9bfe8b3962b6bcdbfc8c82e99255aebcf367867cf0760
MD5 eeaf94447e0a43a9caa6786a9de80b21
BLAKE2b-256 15530afc94574553bad50d7add81f54eed1a864e13f91c3a342c99775a947ff9

See more details on using hashes here.

File details

Details for the file zopfli-0.4.1-cp310-abi3-win_amd64.whl.

File metadata

  • Download URL: zopfli-0.4.1-cp310-abi3-win_amd64.whl
  • Upload date:
  • Size: 102.2 kB
  • Tags: CPython 3.10+, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for zopfli-0.4.1-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 84a31ba9edc921b1d3a4449929394a993888f32d70de3a3617800c428a947b9b
MD5 e9c90b2588aadd40612b5f05c487bbda
BLAKE2b-256 0f94806bc84b389c7d70051d7c9a0179cff52de8b9f8dc2fc25bcf0bca302986

See more details on using hashes here.

File details

Details for the file zopfli-0.4.1-cp310-abi3-win32.whl.

File metadata

  • Download URL: zopfli-0.4.1-cp310-abi3-win32.whl
  • Upload date:
  • Size: 82.3 kB
  • Tags: CPython 3.10+, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for zopfli-0.4.1-cp310-abi3-win32.whl
Algorithm Hash digest
SHA256 a899eca405662a23ae75054affa3517a060362eae1185d3d791c86a50153c4dd
MD5 e483600a27e8f38337599e4b69021379
BLAKE2b-256 ae4d1ef17017d38eabe7ae28f18ef0f16d48966cc23a5657e4555fff61704539

See more details on using hashes here.

File details

Details for the file zopfli-0.4.1-cp310-abi3-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for zopfli-0.4.1-cp310-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 5a4c22b6161f47f5bd34637dbaee6735abd287cd64e0d1ce28ef1871bf625f4b
MD5 09395bdc01e3fc8127dc23026205deaf
BLAKE2b-256 e31b51f7c28d4cde639cac4f5d47ff615548c1d9809f43cbacdd66eba5cd679d

See more details on using hashes here.

File details

Details for the file zopfli-0.4.1-cp310-abi3-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for zopfli-0.4.1-cp310-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 27823dc1161a4031d1c25925fd45d9868ec0cbc7692341830a7dcfa25063662c
MD5 e23a3f204d61bad35a22a28ac524720e
BLAKE2b-256 0d4e9b23690c4ca14fbeae2a8f7f6b2006611bf4cd7d5bcb2d9e6c718bd4b0e9

See more details on using hashes here.

File details

Details for the file zopfli-0.4.1-cp310-abi3-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for zopfli-0.4.1-cp310-abi3-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 d7bcee1b189d64ec33d1e05cfa1b6a1268c29329c382f6ca1bd6245b04925c57
MD5 0670f1dece7dc731063ac4496661596b
BLAKE2b-256 e377d231012ddcaac9d2e184bd7808e106a8a0048855912e2e1c902b3f383413

See more details on using hashes here.

File details

Details for the file zopfli-0.4.1-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for zopfli-0.4.1-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 fdfb7ce9f5de37a5b2f75dd2642fd7717956ef2a72e0387302a36d382440db07
MD5 c310ba020aab5b926cb9a34080cbe591
BLAKE2b-256 dd6f4a1a88edf9fa0ce102703f38ab4dfb285b7cd2dde5389184264ec759e06e

See more details on using hashes here.

File details

Details for the file zopfli-0.4.1-cp310-abi3-macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for zopfli-0.4.1-cp310-abi3-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 4238d4d746d1095e29c9125490985e0c12ffd3654f54a24af551e2391e936d54
MD5 46684df62086a600972230334e9840fb
BLAKE2b-256 e12f1a7082e9163ae3703b27d571720bf3c954a02a9cf1fdce47c51e70639256

See more details on using hashes here.

Supported by

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