skillfed

pyppmd

PPMd compression/decompression library

pyppmd v1.3.1 9.5M downloads/30d#1,528 on PyPI11
Copyleft license LGPL-2.1-or-later Active released

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 pyppmd

uv

uv add pyppmd

poetry

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 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

Development Status :: 5 - Production/StableOperating System :: MacOS :: MacOS XOperating System :: Microsoft :: WindowsOperating System :: POSIXOperating System :: POSIX :: LinuxProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: Software Development :: Libraries :: Python Modules

Tags

PPMd compression decompressiontext data compression libraryprediction by partial matchinglossless compression algorithmalternative to zlib bz2 lzma7-zip compatible compressiondata compression utility
compressionppmd-algorithm7zip-compatible

More Python Modules packages