Skip to main content

PPMd compression/decompression library

Project description


pyppmd module provides classes and functions for compressing and decompressing text data, using PPM(Prediction by partial matching) compression algorithm which has several variations of implementations. PPMd is the implementation by Dmitry Shkarin. PyPPMD use Igor Pavlov’s range coder introduced in 7-zip.

The API is similar to Python’s bz2/lzma/zlib module.

Some parts of th codes are derived from 7-zip, pyzstd and ppmd-cffi.

Development status

A project status is considered as Stable.

Extra input byte

PPMd algorithm and implementation is designed to use Extra input byte. The encoder will omit a last null (b”0”) byte when last byte is b”0”. You may need to provide an extra null byte when you don’t get expected size of extracted data.

You can do like as:

dec = pyppmd.Ppmd7Decoder(max_order=6, mem_size=16 << 10)
result = dec.decode(compressed, length)
if len(result) < length:
    if dec.needs_input:
        # ppmd need an extra null byte
        result += dec.decode(b"\0", length - len(result))
        result += dec.decode(b"", length - len(result))

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyppmd-1.1.0.tar.gz (1.3 MB view hashes)

Uploaded source

Built Distributions

pyppmd-1.1.0-cp312-cp312-win_amd64.whl (46.2 kB view hashes)

Uploaded cp312

pyppmd-1.1.0-cp312-cp312-win32.whl (41.3 kB view hashes)

Uploaded cp312

pyppmd-1.1.0-cp311-cp311-win_amd64.whl (46.1 kB view hashes)

Uploaded cp311

pyppmd-1.1.0-cp311-cp311-win32.whl (41.3 kB view hashes)

Uploaded cp311

pyppmd-1.1.0-cp310-cp310-win_amd64.whl (46.1 kB view hashes)

Uploaded cp310

pyppmd-1.1.0-cp310-cp310-win32.whl (41.3 kB view hashes)

Uploaded cp310

pyppmd-1.1.0-cp39-cp39-win_amd64.whl (46.1 kB view hashes)

Uploaded cp39

pyppmd-1.1.0-cp39-cp39-win32.whl (41.3 kB view hashes)

Uploaded cp39

pyppmd-1.1.0-cp38-cp38-win_amd64.whl (46.2 kB view hashes)

Uploaded cp38

pyppmd-1.1.0-cp38-cp38-win32.whl (41.3 kB view hashes)

Uploaded cp38

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page