Skip to main content

compress and decompress

Project description

✨ pydensity ✨

The python binding for density

pypi python implementation wheel license action

安装

pip install pydensity

使用

  • encode
import pydensity
origin = b"121212121212121"
size = pydensity.decompress_safe_size(len(origin))
data = pydensity.compress(origin, pydensity.Algorithm.lion)
print(pydensity.decompress(data, size))

公开函数

from typing import Any
import enum

class Algorithm(enum.Enum):
    chameleon: Any
    cheetah: Any
    lion: Any

def format_state(state) -> str: ...
def major_version(): ...
def minor_version(): ...
def revision_version(): ...
def get_dictionary_size(algorithm: Algorithm): ...
def compress_safe_size(input_size: int): ...
def decompress_safe_size(input_size: int): ...

class Compressor:
    c_state: Any
    context: Any
    def __init__(self, algorithm: Algorithm, custom_dictionary: bool) -> None: ...
    @property
    def state(self): ...
    def compress(self, data: bytes) -> bytes: ...
    def __del__(self) -> None: ...

class DeCompressor:
    c_state: Any
    context: Any
    def __init__(self, data: bytes, custom_dictionary: bool) -> None: ...
    @property
    def state(self): ...
    def decompress(self, data: bytes, decompress_safe_size: int) -> bytes: ...
    def __del__(self) -> None: ...

def compress(data: bytes, algorithm: Algorithm) -> bytes: ...
def compress_into(data: bytes, out: bytearray, algorithm: Algorithm) -> int: ...
def decompress(data: bytes, decompress_safe_size: int) -> bytes: ...
def decompress_into(data: bytes, out: bytearray) -> int: ...

本机编译

python -m pip install setuptools wheel cython cffi
git clone https://github.com/synodriver/pydensity
cd pydensity
git submodule update --init --recursive
python setup.py bdist_wheel --use-cython --use-cffi

后端选择

默认由py实现决定,在cpython上自动选择cython后端,在pypy上自动选择cffi后端,使用DENSITY_USE_CFFI环境变量可以强制选择cffi

Project details


Download files

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

Source Distribution

pydensity-0.1.1.tar.gz (133.2 kB view hashes)

Uploaded Source

Built Distributions

pydensity-0.1.1-pp310-pypy310_pp73-win_amd64.whl (285.9 kB view hashes)

Uploaded PyPy Windows x86-64

pydensity-0.1.1-pp310-pypy310_pp73-macosx_10_9_x86_64.whl (267.3 kB view hashes)

Uploaded PyPy macOS 10.9+ x86-64

pydensity-0.1.1-pp39-pypy39_pp73-win_amd64.whl (228.5 kB view hashes)

Uploaded PyPy Windows x86-64

pydensity-0.1.1-pp39-pypy39_pp73-macosx_10_9_x86_64.whl (211.5 kB view hashes)

Uploaded PyPy macOS 10.9+ x86-64

pydensity-0.1.1-pp38-pypy38_pp73-win_amd64.whl (228.0 kB view hashes)

Uploaded PyPy Windows x86-64

pydensity-0.1.1-pp38-pypy38_pp73-macosx_10_9_x86_64.whl (211.0 kB view hashes)

Uploaded PyPy macOS 10.9+ x86-64

pydensity-0.1.1-pp37-pypy37_pp73-win_amd64.whl (228.0 kB view hashes)

Uploaded PyPy Windows x86-64

pydensity-0.1.1-pp37-pypy37_pp73-macosx_10_9_x86_64.whl (211.1 kB view hashes)

Uploaded PyPy macOS 10.9+ x86-64

pydensity-0.1.1-cp312-cp312-win_amd64.whl (295.0 kB view hashes)

Uploaded CPython 3.12 Windows x86-64

pydensity-0.1.1-cp312-cp312-manylinux2014_x86_64.whl (318.9 kB view hashes)

Uploaded CPython 3.12

pydensity-0.1.1-cp312-cp312-macosx_10_9_universal2.whl (392.9 kB view hashes)

Uploaded CPython 3.12 macOS 10.9+ universal2 (ARM64, x86-64)

pydensity-0.1.1-cp311-cp311-win_amd64.whl (235.7 kB view hashes)

Uploaded CPython 3.11 Windows x86-64

pydensity-0.1.1-cp311-cp311-manylinux2014_x86_64.whl (260.4 kB view hashes)

Uploaded CPython 3.11

pydensity-0.1.1-cp311-cp311-macosx_10_9_universal2.whl (314.2 kB view hashes)

Uploaded CPython 3.11 macOS 10.9+ universal2 (ARM64, x86-64)

pydensity-0.1.1-cp310-cp310-win_amd64.whl (236.4 kB view hashes)

Uploaded CPython 3.10 Windows x86-64

pydensity-0.1.1-cp310-cp310-manylinux2014_x86_64.whl (260.8 kB view hashes)

Uploaded CPython 3.10

pydensity-0.1.1-cp310-cp310-macosx_11_0_x86_64.whl (224.0 kB view hashes)

Uploaded CPython 3.10 macOS 11.0+ x86-64

pydensity-0.1.1-cp310-cp310-macosx_10_15_x86_64.whl (224.4 kB view hashes)

Uploaded CPython 3.10 macOS 10.15+ x86-64

pydensity-0.1.1-cp39-cp39-win_amd64.whl (237.4 kB view hashes)

Uploaded CPython 3.9 Windows x86-64

pydensity-0.1.1-cp39-cp39-manylinux2014_x86_64.whl (262.2 kB view hashes)

Uploaded CPython 3.9

pydensity-0.1.1-cp39-cp39-macosx_11_0_x86_64.whl (224.5 kB view hashes)

Uploaded CPython 3.9 macOS 11.0+ x86-64

pydensity-0.1.1-cp39-cp39-macosx_10_15_x86_64.whl (224.9 kB view hashes)

Uploaded CPython 3.9 macOS 10.15+ x86-64

pydensity-0.1.1-cp38-cp38-win_amd64.whl (237.6 kB view hashes)

Uploaded CPython 3.8 Windows x86-64

pydensity-0.1.1-cp38-cp38-manylinux2014_x86_64.whl (261.9 kB view hashes)

Uploaded CPython 3.8

pydensity-0.1.1-cp38-cp38-macosx_11_0_x86_64.whl (281.1 kB view hashes)

Uploaded CPython 3.8 macOS 11.0+ x86-64

pydensity-0.1.1-cp38-cp38-macosx_10_15_x86_64.whl (222.8 kB view hashes)

Uploaded CPython 3.8 macOS 10.15+ x86-64

pydensity-0.1.1-cp37-cp37m-win_amd64.whl (236.8 kB view hashes)

Uploaded CPython 3.7m Windows x86-64

pydensity-0.1.1-cp37-cp37m-manylinux2014_x86_64.whl (260.5 kB view hashes)

Uploaded CPython 3.7m

pydensity-0.1.1-cp37-cp37m-macosx_11_0_x86_64.whl (281.3 kB view hashes)

Uploaded CPython 3.7m macOS 11.0+ x86-64

pydensity-0.1.1-cp37-cp37m-macosx_10_15_x86_64.whl (223.5 kB view hashes)

Uploaded CPython 3.7m macOS 10.15+ x86-64

pydensity-0.1.1-cp36-cp36m-win_amd64.whl (237.0 kB view hashes)

Uploaded CPython 3.6m Windows x86-64

pydensity-0.1.1-cp36-cp36m-manylinux2014_x86_64.whl (260.7 kB view hashes)

Uploaded CPython 3.6m

pydensity-0.1.1-cp36-cp36m-macosx_10_14_x86_64.whl (222.9 kB view hashes)

Uploaded CPython 3.6m macOS 10.14+ x86-64

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