Skip to main content

pawzip

A lossless compression algorithm that records where each byte value appears and describes those positions with patterns. It writes .paw files.

On the Silesia benchmark it compresses better than bzip2 and nearly as well as xz, but it is slower than both. It does best on structured and repetitive data, and stores data it can't compress, such as noise or files that are already compressed, as it is. The .paw format is frozen, so files written today will decode with every later version.

pip install pawzip

Requires Python 3.10+ and NumPy. The wheels include the compressor's core, compiled from Rust; installing from source needs Rust. The package is fully type-annotated.

Compress and decompress

import paw

data = b"hello world\n" * 1000
packed = paw.compress(data)
assert paw.decompress(packed) == data

compress tries the modes that suit the data and keeps the smallest result. Data that is already compressed (JPEG, ZIP, video) is recognised from a sample and stored as it is. modes=[paw.Mode.MAP] tries only the modes you list, which is faster, and thorough=True tries every mode even on already-compressed data: many times slower, for a percent or so.

Files and streams

import paw

paw.compress_file("notes.txt")  # writes notes.paw and remembers ".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")
  • Only the extension is stored, never the name, so a renamed abc.paw made from photo.png decompresses to abc.png. With compress and compress_stream, pass extension="png" yourself.
  • Data is processed in blocks (16 MiB by default, block_size=), so files of any size use bounded memory. compress_file, decompress_file, paw.open, compress_stream and decompress_stream all stream.
  • compress_file and decompress_file never overwrite a file unless overwrite=True, and never leave a partial file behind.
  • The file and stream functions take a progress callback, called after each block (and once at the end) with the number of input bytes done so far.

Untrusted input

import paw

packed = paw.compress(b"data from somewhere\n" * 1000)
data = paw.decompress(packed, max_size=100 * 1024 * 1024)  # refuse more than 100 MiB

Every block is checked with a CRC-32. A small file can claim an enormous size, so set max_size for input you don't trust: anything bigger is refused before memory is allocated. Blocks larger than max_block_size (64 MiB by default) are refused the same way; files written with the default block size are never affected.

File information

import paw

meta = paw.info(paw.compress(b"hello world\n" * 1000))  # a .paw path works too
print(meta.original_size, meta.compressed_size, meta.ratio, meta.mode_summary)

info reads only the headers, so it's fast even for large files.

Parallel work

workers=4 compresses or decompresses four blocks at a time, and workers="auto" uses as many CPU cores as fit into half of the free memory (one where free memory can't be measured, currently macOS). Only data with several blocks gains. Workers are threads; without the Rust core they are processes, which need the usual if __name__ == "__main__": guard on Windows and macOS.

Errors

paw.FormatError (not a .paw file, or a damaged one) and paw.SizeLimitError (over max_size or max_block_size) both derive from paw.PawError, which is a ValueError.

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)

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

Speed and memory

  • Compression runs at about 1.7 MB/s on one core (Silesia benchmark), close to xz -9, and at about 3.5 MB/s with four cores, since the modes are tried in parallel. Decompression runs at about 18 MB/s, a little slower than bzip2 and about 3 times slower than xz.
  • Compressing needs up to about 100 times the block size in memory per worker (about 1.6 GB for a 16 MiB block); decompressing needs about 7 times. Use a smaller block_size on machines with little memory.
  • PAW_PURE=1 switches to the pure-Python reference implementation: the same files, about 50 times slower, and decompressing needs about 20 times the block size.

Learn more

Metadata

Release files for pawzip 1.0.1

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.1
File Size Uploaded Provenance Actions
pawzip-1.0.1.tar.gz 70.9 kB With provenance Details for pawzip-1.0.1.tar.gz

Built distributions (wheels)

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

Total release size: 1.7 MB

Release files / pawzip-1.0.1.tar.gz

Download URL pawzip-1.0.1.tar.gz
Size 70.9 kB
Tags Source
SHA-256 checksum
How to use checksums
a5a77c0715b3d83fa59fa8ad7910cfb4f32926013d2a5a98bde5395b8a691042
BLAKE2b-256 checksum
How to use checksums
9502143e7fcbc12ca1921fe635aefa3d51b2ce9cf6ce3a3e37cb148e983f33bb
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 17, 2026.

Transparency log

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

Download URL pawzip-1.0.1-cp310-abi3-win_amd64.whl
Size 254.1 kB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
f2d2ceb3f353f9533ac55de63009346a374c6b3094c6d4fbe12ab914648a94b5
BLAKE2b-256 checksum
How to use checksums
bc2e2a44dd9b4b77ffc8332e06aafc582dc1fdf2ed51875bc2fe7ad2450acde1
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 17, 2026.

Transparency log

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

Download URL pawzip-1.0.1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 362.6 kB
Tags CPython 3.10 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
3f10eddc6c7f9f190c8b96d5a881bc479cb16ae0826de4f19ec62dc923d4c5fa
BLAKE2b-256 checksum
How to use checksums
003f0d18494b7363a437350a3d40c3771150ca0e59492e1d35785f61640092e9
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 17, 2026.

Transparency log

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

Download URL pawzip-1.0.1-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 354.8 kB
Tags CPython 3.10 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
e8ebf14c9f2ba7dc1f7fdf66ea829fca8ad5e7feca4221ca1d186d823dc102e4
BLAKE2b-256 checksum
How to use checksums
f2a2811cc4d5b1b5908648535135a126f0a940f8baa505d5044d7ff87aa5e738
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 17, 2026.

Transparency log

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

Download URL pawzip-1.0.1-cp310-abi3-macosx_11_0_arm64.whl
Size 334.1 kB
Tags CPython 3.10 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
f128efb27c1f3550a384849b2c500576919c224d05eb01990e7036e7e09e9d0a
BLAKE2b-256 checksum
How to use checksums
269b37a72fb0b7019f7c75c7ad4675e0f908dc3aa0672ffd39f6a47fa1d20520
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 17, 2026.

Transparency log

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

Download URL pawzip-1.0.1-cp310-abi3-macosx_10_12_x86_64.whl
Size 345.3 kB
Tags CPython 3.10 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
83fee1cc0452a26d9c511311c15d4d10bb5df2385a791cca9a509fb04465cb05
BLAKE2b-256 checksum
How to use checksums
6ccfb89d8cd11f7424d0f597088bce1f976aedaf9fe8de02349c15b7e9638c1c
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 17, 2026.

Transparency log

Security for pawzip 1.0.1

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.

Full provenance

All 6 files in this release have been uploaded with provenance metadata.

Select from 6 files

Attestation for pawzip-1.0.1.tar.gz

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 17, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.1 This release

6 release files Full provenance

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