Skip to main content

PPMd compression/decompression library

Project description

https://readthedocs.org/projects/pyppmd/badge/?version=latest https://badge.fury.io/py/pyppmd.svg https://img.shields.io/conda/vn/conda-forge/pyppmd https://github.com/miurahr/pyppmd/workflows/Run%20Tox%20tests/badge.svg https://coveralls.io/repos/github/miurahr/pyppmd/badge.svg?branch=main

Introduction

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 development status is considered as Beta.

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))
    else:
        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.0.0.tar.gz (1.4 MB view hashes)

Uploaded source

Built Distributions

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

Uploaded cp311

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

Uploaded cp311

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

Uploaded cp310

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

Uploaded cp310

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

Uploaded cp39

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

Uploaded cp39

pyppmd-1.0.0-cp38-cp38-win_amd64.whl (46.1 kB view hashes)

Uploaded cp38

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

Uploaded cp38

pyppmd-1.0.0-cp37-cp37m-win_amd64.whl (46.1 kB view hashes)

Uploaded cp37

pyppmd-1.0.0-cp37-cp37m-win32.whl (41.1 kB view hashes)

Uploaded cp37

pyppmd-1.0.0-cp36-cp36m-win_amd64.whl (42.0 kB view hashes)

Uploaded cp36

pyppmd-1.0.0-cp36-cp36m-win32.whl (37.1 kB view hashes)

Uploaded cp36

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page