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.2.tar.gz (179.1 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.2-pp311-pypy311_pp73-win_amd64.whl (102.1 kB view details)

Uploaded PyPyWindows x86-64

zopfli-0.4.2-pp311-pypy311_pp73-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl (124.3 kB view details)

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

zopfli-0.4.2-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.2-pp311-pypy311_pp73-macosx_10_15_x86_64.whl (147.0 kB view details)

Uploaded PyPymacOS 10.15+ x86-64

zopfli-0.4.2-cp310-abi3-win_amd64.whl (102.1 kB view details)

Uploaded CPython 3.10+Windows x86-64

zopfli-0.4.2-cp310-abi3-win32.whl (82.2 kB view details)

Uploaded CPython 3.10+Windows x86

zopfli-0.4.2-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.2-cp310-abi3-musllinux_1_2_aarch64.whl (1.8 MB view details)

Uploaded CPython 3.10+musllinux: musl 1.2+ ARM64

zopfli-0.4.2-cp310-abi3-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl (818.4 kB view details)

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

zopfli-0.4.2-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.2-cp310-abi3-macosx_10_9_universal2.whl (291.5 kB view details)

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

File details

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

File metadata

  • Download URL: zopfli-0.4.2.tar.gz
  • Upload date:
  • Size: 179.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for zopfli-0.4.2.tar.gz
Algorithm Hash digest
SHA256 a75e646fed3a2a42a82e69a81644009189c8ab4271691f020d52da8630d0580e
MD5 1a59a86bd9761068a45c48cf8853ae59
BLAKE2b-256 054db5a8c14cfc7beb5dd798f316418126b5107a54d5f9ba322ad874089b91ce

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zopfli-0.4.2-pp311-pypy311_pp73-win_amd64.whl
Algorithm Hash digest
SHA256 d036b7179c225ce6bd73e68b5a176319ce8835739f494650e4124cd9c383b826
MD5 f1f6dd2442b7d1e7910736d453b5ab9f
BLAKE2b-256 7e094c2503066e6dc4a42687dbc0a1026b47bc720d81238cc23f626970b3646f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zopfli-0.4.2-pp311-pypy311_pp73-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 e679896fde39930dec1f46e5f4e1b1900378686168064966209ffb7b80e41743
MD5 c71920fe894d9fe25ca6fc725e0214c1
BLAKE2b-256 f32b10b8faaf3f15a69126d048662c9021e908f9f33bc49ff4df3c93decd59a1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zopfli-0.4.2-pp311-pypy311_pp73-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 1fc2fd1725c986f535ea323139ec1b974fa294ef9574e0fad840967d52dd38a9
MD5 ccf1210fdda605af68b4d425e45ff188
BLAKE2b-256 51e1879107e44f3cc097204ff2f36c873a7d4c9660edd930058427eba76c9ba1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zopfli-0.4.2-pp311-pypy311_pp73-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 92e30df03a00c08b3265c362566573b50a3af3b113b0dbe755071376635ce93d
MD5 a2ff6b37d56980390376be3fdb3ec734
BLAKE2b-256 d2f9998d2f70aa29afaf326c989becd4e800d0584985ee154c6ffb3b85727c54

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for zopfli-0.4.2-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 bc25a3b3568910afb4bbd951d99835de29cade95417bca215339eac172eb381d
MD5 93bbacdcf7913a1b78b822f22d34305d
BLAKE2b-256 04f6f75c781c1464045a3c465625e813605636f09e5fb2e15494eeee5263f8ef

See more details on using hashes here.

File details

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

File metadata

  • Download URL: zopfli-0.4.2-cp310-abi3-win32.whl
  • Upload date:
  • Size: 82.2 kB
  • Tags: CPython 3.10+, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for zopfli-0.4.2-cp310-abi3-win32.whl
Algorithm Hash digest
SHA256 d3bc0b483575ab8849d9c15b349f78ae0141eb4dfe2ba260c8fdc0b3ba5c6c42
MD5 b3d85ac48c3367b17ae44caff513f6e4
BLAKE2b-256 380e11dab5379262c9b19ec9a2d8c0bc4314f62a47047ac6f54912a2e0fb82df

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zopfli-0.4.2-cp310-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 70c20595aa30aae246ac71a9fa471e2aa768318150ab814aeea2f651c59c6a32
MD5 4be6ed307e797dcb3d346a5f00af0a05
BLAKE2b-256 73ec0959952a13124b5d58829f808daabe2d2e0358d25b33f7460366ddab21ce

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zopfli-0.4.2-cp310-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 65a847b1f234df456584f0267fb0f270a95772e675a98ae9c21f3b4839077b2f
MD5 6bd9815a719d35eb42950a8a6727c575
BLAKE2b-256 3cddfe32b457a95f4f75e96bba99d86935c3c5be988b1389c85cf4bbe2194844

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zopfli-0.4.2-cp310-abi3-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 18af6d2f778552d9bfdaa8e6caaf38c2bd57d0efba34a47860fcc4f6ba899696
MD5 65567af2abed54145122760a5613331f
BLAKE2b-256 bb74ff2a9351738fd6ec86249c4daaff3e4afb0deb3a8bff3640f3c6f3212a2b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zopfli-0.4.2-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 932083f7ca190fbd73cdf8ad7d32ec7231ecd25e1b3fade547cfb11b823ff91f
MD5 7e5dc3d1409942d8c29ee80ff8591a0e
BLAKE2b-256 38fcb50b1cc4d192953552751b3ed809a68c005392e14aefd78f63067fb7493f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zopfli-0.4.2-cp310-abi3-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 d1972b58083b85af460d8936f623d849b487c151b26eae925b25ec921ae6cd22
MD5 d9c4d59d7b6e9f702e92bf62b0db06b9
BLAKE2b-256 a8ddf2b25f7dd657db0fdd0436ea4caa0f5709132d65728bfb2d48ee11bc8bf7

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