Skip to main content

pawzip

pawzip is a lossless compressor that writes .paw files. Instead of storing data byte by byte, it records where each byte value appears and describes those positions with arithmetic series and nested loops where it can, storing the rest as compactly coded gaps.

On the Silesia benchmark it compresses better than bzip2 and nearly as well as xz, but it is slower than both (see Limitations). It does best on structured and repetitive data, and data it can't compress, such as noise or files that are already compressed, is stored as it is.

pip install pawzip

Requires Python 3.10+ and NumPy. The wheels include the compressor's core compiled from Rust; installing from source needs a Rust toolchain (rustup.rs). Setting the environment variable PAW_PURE=1 switches to the pure-Python reference implementation (same output, much slower).

Python API

import paw

data = b"hello world\n" * 1000
blob = paw.compress(data)  # bytes -> .paw bytes
assert paw.decompress(blob) == data  # .paw bytes -> the original bytes

meta = paw.info(blob)  # read the headers without decompressing (a path works too)
print(meta.original_size, meta.compressed_size, meta.ratio, meta.mode_summary)

paw.compress_file("notes.txt")  # writes notes.paw, remembering ".txt"
paw.decompress_file("notes.paw", "copy.txt")  # without a destination: notes.txt

with paw.open("log.paw", "wt", encoding="utf-8", extension="txt") as f:  # like gzip.open
    f.write("hello\n")
  • compress(data, modes=None) tries every suitable mode and keeps the smallest result. Pass modes=[paw.Mode.MAP] (or another paw.Mode) to try only those modes, which is faster.
  • decompress(blob, max_size=None) verifies a CRC-32 of every block. For untrusted input, pass max_size: a tiny file can claim an enormous size, and max_size refuses it before any memory is allocated.
  • Decoding a block needs about 7x its size in memory (20x in pure Python), so blocks larger than max_block_size (default 64 MiB) are refused the same way. Files written with the default block size are never affected; pass a larger max_block_size (CLI --max-block-size) for files written with bigger blocks.
  • File names: photo.png compresses to photo.paw, and the extension png is stored inside it. Decompressing gives back photo.png, or abc.png if you renamed the file to abc.paw. Only the extension is stored, never the name. For compress and compress_stream, pass extension="png" yourself.
  • Already-compressed data (JPEG, ZIP, video) is recognised from a small sample and stored as it is, in a fraction of a second. thorough=True (CLI --thorough) tries every mode anyway: many times slower, for a percent or so.
  • compress_file / decompress_file never overwrite an existing file unless overwrite=True, and never leave a partial output file behind on failure.
  • Data is split into independent blocks (default 16 MiB, block_size=), so files of any size can be compressed and decompressed with bounded memory. compress_file, decompress_file, paw.open, compress_stream and decompress_stream all stream.
  • compress_file, decompress_file, compress_stream and decompress_stream accept a progress callback: it is called after each block, and once at the end, with the number of input bytes processed so far (handy for a progress bar).
  • Parallel compression and decompression are opt-in: workers=4 (CLI -T 4), or workers="auto" to use the CPU cores that fit into half of the currently free memory. Files with several blocks gain: Webster in 4 MiB blocks compresses at 13.6 MB/s and decompresses at 78 MB/s with 4 workers. The default is a single worker, and "auto" also uses one where free memory can't be measured (currently macOS; pass a number there). Workers are threads; only the pure-Python fallback uses processes, which need the usual if __name__ == "__main__": guard on Windows/macOS.
  • Errors: paw.FormatError (not a valid or a damaged .paw file) and paw.SizeLimitError (over max_size or max_block_size), both subclasses of paw.PawError, which is a ValueError.

The package is fully type-annotated.

Command line

paw compress notes.txt                 # -> notes.paw
paw decompress notes.paw               # -> notes.txt (also after renaming it)
paw test archive.paw                   # check it decompresses correctly
paw info archive.paw                   # sizes, blocks and modes
cat data.bin | paw compress - > data.bin.paw
paw decompress --max-size 500M -c big.paw > big
paw compress -T auto -B 8M huge.iso    # parallel, 8 MiB blocks
paw compress --thorough photo.jpg      # squeeze already-compressed files too (slow)

When stderr is a terminal, a progress line shows how far each file has got and roughly how long is left (-q hides it). Run paw COMMAND --help for all options. Exit status is 0 on success, 1 if any file failed, 2 on usage errors and 130 if interrupted.

Limitations

  • Speed (Rust core, Silesia benchmark): on one core, compression runs at about 1.7 MB/s, close to xz -9, and decompression at about 18 MB/s, a little slower than bzip2 and about 3x slower than xz. Compression tries its modes in parallel, so with several cores it is faster: about 3.5 MB/s on a 4-core Intel Core i3-12100F. The pure-Python reference (PAW_PURE=1) is about 50x slower.
  • Memory: compressing needs up to about 100x the block size per worker (about 1.6 GB for a full 16 MiB block, when several modes are tried at once); decompressing needs about 7x (about 110 MB; 20x in pure Python). Use a smaller block_size on machines with little memory.
  • The .paw format v1 is frozen: files written now will decode with every later version.

Metadata

Release files for pawzip 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pawzip 1.0.0
File Size Uploaded
pawzip-1.0.0.tar.gz 73.6 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for pawzip 1.0.0
File
pawzip-1.0.0-cp310-abi3-win_amd64.whl CPython 3.10 abi3 Windows x86-64 Details
pawzip-1.0.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.10 abi3 Linux glibc 2.17+ x86-64 Details
pawzip-1.0.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.10 abi3 Linux glibc 2.17+ ARM64 Details
pawzip-1.0.0-cp310-abi3-macosx_11_0_arm64.whl CPython 3.10 abi3 macOS 11.0+ ARM64 Details
pawzip-1.0.0-cp310-abi3-macosx_10_12_x86_64.whl CPython 3.10 abi3 macOS 10.12+ x86-64 Details

Total release size: 1.7 MB

Release files / pawzip-1.0.0.tar.gz

Download URL pawzip-1.0.0.tar.gz
Size 73.6 kB
Tags Source
SHA-256 checksum
How to use checksums
320f0c3ab4f1f9698e9fe1abab8b61428f1123e549e82e6e230e72dc108ef09d
BLAKE2b-256 checksum
How to use checksums
ad79a5781fea6f50b1f22a6ede71017178a6afaf60a3ed0474ef8043dc844d32
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 15, 2026.

Transparency log

Release files / pawzip-1.0.0-cp310-abi3-win_amd64.whl

Download URL pawzip-1.0.0-cp310-abi3-win_amd64.whl
Size 249.8 kB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
abbd4d3bc0368aa160510ebf3d8a46e11bc9bb75d563547e750329b0b641f5e5
BLAKE2b-256 checksum
How to use checksums
7fa3cc0ea344ddb367b4d5e2f6a222898b7f89eb03e103d53d94ff37bc39b984
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 15, 2026.

Transparency log

Release files / pawzip-1.0.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL pawzip-1.0.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 358.5 kB
Tags CPython 3.10 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
dd1499bcec0f827ff3c2ed6355acd08fc922f2c58d9022dbeef152984467789c
BLAKE2b-256 checksum
How to use checksums
4858d62bec84f58690c35953a5a47c5f539fd4d860d21d7d33a986faaed5077b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 15, 2026.

Transparency log

Release files / pawzip-1.0.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL pawzip-1.0.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 352.1 kB
Tags CPython 3.10 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
0f0a352ad8098f6288d2b54f7bb1695575c139767903789bdb602aeabd2d057c
BLAKE2b-256 checksum
How to use checksums
700ba51b1927bd308706a967d0d14a9db81721869b150e1f365467da1048eaa7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 15, 2026.

Transparency log

Release files / pawzip-1.0.0-cp310-abi3-macosx_11_0_arm64.whl

Download URL pawzip-1.0.0-cp310-abi3-macosx_11_0_arm64.whl
Size 330.8 kB
Tags CPython 3.10 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
b0b4a3a412a01e2f889a1a976866cb6e67df2771a583f5ad012b375ac1f0bbc1
BLAKE2b-256 checksum
How to use checksums
3466ad5941d6b6bcff7de4bcbca2f37aa355f595f7671dfd92065b7c19635959
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 15, 2026.

Transparency log

Release files / pawzip-1.0.0-cp310-abi3-macosx_10_12_x86_64.whl

Download URL pawzip-1.0.0-cp310-abi3-macosx_10_12_x86_64.whl
Size 344.0 kB
Tags CPython 3.10 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
90843838f1da0f9e0b6f04464249008d0e1574b391aca293233327ec49ea7ab9
BLAKE2b-256 checksum
How to use checksums
8aae51eb6f9ab2d02ad4cbd351f2482577fac3bfce83e8324ae4171c6bf712dd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 15, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.0.0 This release

6 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page