miurahr/pyppmd
3
0
Fork
You've already forked pyppmd
2
pyppmd provides classes and functions for compressing and decompressing text data, using PPM (Prediction by partial matching) compression algorithm variation H and I.2. It provide an API similar to Python's zlib/bz2/lzma modules.
  • C 73.7%
  • Python 23.7%
  • CMake 2.6%
Hiroshi Miura 52da9d1a15
Some checks failed
ci/woodpecker/push/check/1 Pipeline failed
ci/woodpecker/push/check/3 Pipeline was successful
ci/woodpecker/push/check/4 Pipeline was successful
ci/woodpecker/push/check/5 Pipeline was successful
ci/woodpecker/push/check/2 Pipeline was successful
Merge remote-tracking branch 'origin/main'
2025年12月21日 10:59:44 +09:00
.github chore: update CI workflow to expand matrix and support additional configurations 2025年11月29日 11:38:34 +09:00
.woodpecker chore: fix woodpeker-ci to drop 3.8 2024年12月23日 12:39:42 +09:00
docs chore: update URLs in documentation to use HTTPS for improved security 2025年11月29日 12:01:51 +09:00
issue_template Configure for codeberg CI 2022年07月27日 08:56:06 +09:00
src fix: handle buffer conditions to prevent deadlocks and notify controller ( #126 ) 2025年11月27日 16:46:36 +09:00
tests Skip benchmark tests if cpuinfo module is not supported 2024年05月06日 09:28:33 +09:00
utils Benchmark: drop ratex print 2021年04月22日 08:14:27 +09:00
.flake8 Drop setup.cfg 2022年11月15日 12:44:55 +09:00
.git_archival.txt chore: allow build on git export source tree 2023年11月07日 15:45:10 +09:00
.gitattributes chore: allow build on git export source tree 2023年11月07日 15:45:10 +09:00
.gitignore chore: update tox configuration 2023年11月04日 18:40:25 +09:00
Changelog.rst Release v1.3.1 2025年11月28日 00:27:22 +09:00
CMakeLists.txt chore: allow build on git export source tree 2023年11月07日 15:45:10 +09:00
LICENSE Update License notifications 2022年05月18日 12:11:31 +09:00
MANIFEST.in chore: fix sdist config 2023年11月04日 10:56:56 +09:00
pyproject.toml chore: refactor tox configuration for modern syntax and enhanced readability 2025年11月29日 11:58:06 +09:00
README.rst chore: update copyright years in README 2025年11月29日 18:07:05 +09:00
SECURITY.rst Update Security policy 2022年11月15日 14:56:17 +09:00
setup.py fix: handle buffer conditions to prevent deadlocks and notify controller ( #126 ) 2025年11月27日 16:46:36 +09:00

PyPPMd

image

image

image

image

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 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))
 else:
 result += dec.decode(b"", length - len(result))

Warning

When use it on MSYS2/MINGW64 environment, you should set environment variable SETUPTOOLS_USE_DISTUTILS=stdlib

Some codes are derived from p7zip/7zip and pyzstd project. Details are shown in LicenseNotices.rst

PyPPMd is licensed under GNU Lesser General Public License v2.1 or later.

  • Copyright (C) 2020-2025 Hiroshi Miura
  • Copyright (C) 2020-2021 Ma Lin
  • Copyright (C) 2010-2012 Lockless Inc.
  • Copyright (C) 1999-2017 Igor Pavlov

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA