--- id: pyppmd version: "1.3.1" license: LGPL-2.1-or-later license_treatment: copyleft maintenance: active --- # pyppmd — PPMd compression/decompression library License: copyleft · Maintenance: active · Downloads: 9.5M/mo ## 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 above — 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 pip install pyppmd uv add pyppmd poetry add pyppmd ## Installing 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_current - Install friction: medium - Maintenance: active - Downloads: 9.5M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags PPMd compression decompression, text data compression library, prediction by partial matching, lossless compression algorithm, alternative to zlib bz2 lzma, 7-zip compatible compression, data compression utility, compression, ppmd-algorithm, 7zip-compatible [View on SkillFed](https://skillfed.io/packages/pyppmd) · [View on PyPI](https://pypi.org/project/pyppmd/)