pyppmd
PPMd compression/decompression library
What it is and what it does
PyPPMd is a Python binding to the PPMd compression algorithm, an implementation by Dmitry Shkarin that uses Igor Pavlov's range coder from 7-zip. It provides encoder and decoder classes (like Ppmd7Decoder) that compress and decompress data using prediction by partial matching, a statistical compression technique. The API mirrors Python's standard library compression modules (bz2, lzma, zlib), making it familiar to Python developers. The package is a thin wrapper around compiled C code, so installation uses prebuilt wheels for common platforms and Python versions.
The main practical consideration is that PPMd's algorithm design requires an 'extra input byte' (typically a null byte) during decompression in some cases; the documentation shows how to detect and handle this. The library is copyleft-licensed (LGPL-2.1-or-later) and includes code derived from 7-zip and other projects, so derivative or linked works must comply with those terms. It supports Python 3.10 and later on CPython and PyPy.
Use it for:
- Decompress PPMd-compressed archives or data streams when interoperating with 7-zip or other PPMd-based tools.
- Implement custom compression pipelines where PPMd's statistical model offers better compression than zlib or bz2 for specific text or data types.
- Archive or store highly compressible data (text, source code, logs) where compression ratio matters more than speed.
- Integrate PPMd compression into Python applications that need to match compression formats used by existing 7-zip workflows.
- Benchmark or evaluate PPMd against other compression algorithms in a pure-Python environment.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Compresses and decompresses data using the PPMd (Prediction by Partial Matching) algorithm, with an API similar to Python's built-in bz2, lzma, and zlib modules.
Yes, if you need PPMd compression specifically (e.g., for 7-zip interoperability or when its statistical model suits your data). The package is stable, actively maintained, has no known vulnerabilities, and installs easily via prebuilt wheels. Be aware of the copyleft license (LGPL-2.1-or-later) and the 'extra input byte' quirk in decompression. Not necessary if standard library compression (zlib, bz2, lzma) meets your needs.
Install
pyppmd on PyPI
pip
pip install pyppmduv
uv add pyppmdpoetry
poetry add pyppmdInstalling pyppmd
Before you install
Medium install friction due to compiled wheels; prebuilt binaries available for Python 3.10–3.14 across macOS, Linux, Windows, and ARM platforms, reducing build-time overhead. Repository is active with recent commits.
License in practice
Licensed under LGPL-2.1-or-later (copyleft). Derivative code from 7-zip, pyzstd, and ppmd-cffi is included; users must comply with copyleft obligations if they distribute modified versions or link this library into proprietary software.
Quickstart
import pyppmd
# Compress data
enc = pyppmd.Ppmd7Encoder(max_order=6, mem_size=16 << 10)
compressed = enc.encode(b"Hello, World!")
# Decompress data
dec = pyppmd.Ppmd7Decoder(max_order=6, mem_size=16 << 10)
decompressed = dec.decode(compressed, len(b"Hello, World!"))
Requires Python 3.10 or later. PPMd decompression may require an extra null byte (b"\0") if the decoder's needs_input flag is set after partial decompression.
Verify before relying
- Performance characteristics (compression ratio, speed) compared to zlib, bz2, or lzma for typical use cases.
- Whether the 'extra input byte' requirement (PPMd algorithm design) is a practical limitation for most workflows.
- Real-world adoption rate and stability feedback beyond the 'Stable' classifier.
Package facts
| License | LGPL-2.1-or-later (copyleft) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | medium — platform-specific wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 260 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 9,524,186/month — #1,528 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pyppmd-1.3.1-cp310-cp310-macosx_10_9_universal2.whl; pyppmd-1.3.1-cp310-cp310-macosx_10_9_x86_64.whl; pyppmd-1.3.1-cp310-cp310-macosx_11_0_arm64.whl; pyppmd-1.3.1-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl; pyppmd-1.3.1-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl; pyppmd-1.3.1-cp310-cp310-musllinux_1_2_aarch64.whl; pyppmd-1.3.1-cp310-cp310-musllinux_1_2_x86_64.whl; pyppmd-1.3.1-cp310-cp310-win32.whl; pyppmd-1.3.1-cp310-cp310-win_amd64.whl; pyppmd-1.3.1-cp310-cp310-win_arm64.whl; pyppmd-1.3.1-cp311-cp311-macosx_10_9_universal2.whl; pyppmd-1.3.1-cp311-cp311-macosx_10_9_x86_64.whl; pyppmd-1.3.1-cp311-cp311-macosx_11_0_arm64.whl; pyppmd-1.3.1-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl; pyppmd-1.3.1-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl; pyppmd-1.3.1-cp311-cp311-musllinux_1_2_aarch64.whl; pyppmd-1.3.1-cp311-cp311-musllinux_1_2_x86_64.whl; pyppmd-1.3.1-cp311-cp311-win32.whl; pyppmd-1.3.1-cp311-cp311-win_amd64.whl; pyppmd-1.3.1-cp311-cp311-win_arm64.whl
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
py7zrpy7zr is a pure-Python library for reading,…
copyleft · top 5,000 on PyPI
pyzstdProvides Python bindings to the Zstandard…
permissive · top 5,000 on PyPI
partdPartd is a key-value byte store that appends…
permissive · top 1,000 on PyPI
pylzsspylzss decodes and encodes data compressed with…
copyleft · top 15,000 on PyPI
python-neo-lzfProvides fast compression and decompression of…
permissive · top 15,000 on PyPI
bz2fileProvides a drop-in replacement for Python's…
permissive · top 15,000 on PyPI
cmeel-zlibProvides zlib 1.3.2 as a pre-built wheel for…
permissive · top 15,000 on PyPI
zlib-ngProvides faster zlib and gzip compression and…
permissive · top 5,000 on PyPI
pybcjpybcj provides Python bindings to a BCJ…
copyleft · top 5,000 on PyPI
ncompressProvides LZW compression and decompression…
permissive · top 15,000 on PyPI