Skip to main content

All in one data compression library.

Project description

https://github.com/MacHu-GWU/compress-project/workflows/CI/badge.svg https://codecov.io/gh/MacHu-GWU/compress-project/branch/master/graph/badge.svg https://img.shields.io/pypi/v/compress.svg https://img.shields.io/pypi/l/compress.svg https://img.shields.io/pypi/pyversions/compress.svg https://img.shields.io/badge/STAR_Me_on_GitHub!--None.svg?style=social
https://img.shields.io/badge/Link-Document-blue.svg https://img.shields.io/badge/Link-API-blue.svg https://img.shields.io/badge/Link-Source_Code-blue.svg https://img.shields.io/badge/Link-Install-blue.svg https://img.shields.io/badge/Link-GitHub-blue.svg https://img.shields.io/badge/Link-Submit_Issue-blue.svg https://img.shields.io/badge/Link-Request_Feature-blue.svg https://img.shields.io/badge/Link-Download-blue.svg

Welcome to compress Documentation

There’s lots of mature data compression algorithm you can choose from, compress provides normalized API to use them and switch between them.

It supports:

From Python Standard library:

From Community (Additional Library Required):

  • snappy, from Google, lower compression ratio but super fast! (on MacOS, you need to install it via brew install snappy, on Ubuntu, you need sudo apt-get install libsnappy-dev.

  • lz4, lower ratio, super fast!

Usage:

>>> from compress import Compressor
>>> binary_data = ("hello world! " * 100).encode("utf-8")
>>> c = Compressor()
>>> c.use_gzip() # or use_bz2, use_lzma, use_lz4, use_snappy
>>> c.compress(binary_data, zlib_level=9)
>>> c.decompress(binary_data)

Other API for lazy developer:

>>> import compress
>>> compress.compress_bytes_to_bytes
>>> compress.compress_str_to_bytes
>>> compress.compress_bytes_to_b64str # compress, and returns b64 encoded str
>>> compress.compress_str_to_b64str # compress string and returns b64 encoded str

>>> compress.decompress_bytes_to_bytes # inverse of compress_bytes_to_bytes
>>> compress.decompress_bytes_to_str # inverse of compress_str_to_bytes
>>> compress.decompress_b64str_to_bytes # inverse of compress_bytes_to_b64str
>>> compress.decompress_b64str_to_str # inverse of compress_str_to_b64str

    compress_bytes_to_bytes, compress_str_to_bytes,
compress_bytes_to_b64str, compress_str_to_b64str,
decompress_bytes_to_bytes, decompress_bytes_to_str,
decompress_b64str_to_bytes, decompress_b64str_to_str,

This website provides comprehensive comparison and visualization. But how do you know how it works on your own production environment?.

compress comes with a tool to run benchmark test for All test case, All algorithm, All parameters, and you will get informative stats about ratio, compress/decompress speed in .tab and ascii table format. Then You are able to visualize it in the way you preferred.

To run benchmark test, just:

$ pip install -r requirements-benchmark.txt
$ python ./benchmark/run.py

Install

compress is released on PyPI, so all you need is:

$ pip install compress

To upgrade to latest version:

$ pip install --upgrade compress

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

compress-0.0.3.tar.gz (15.3 kB view details)

Uploaded Source

Built Distribution

compress-0.0.3-py2.py3-none-any.whl (14.2 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file compress-0.0.3.tar.gz.

File metadata

  • Download URL: compress-0.0.3.tar.gz
  • Upload date:
  • Size: 15.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.6.2

File hashes

Hashes for compress-0.0.3.tar.gz
Algorithm Hash digest
SHA256 e5a44d50f78f1d8957f9ecd99d8a200cd22cac2f8e5d7f18bf070cd1f235500a
MD5 4a6aea0d69ca6bc7f54095a7db790b86
BLAKE2b-256 8e0e50c6133f6695e93aabf32c9a1c69aba1f976202993a1fbeb69a208604a76

See more details on using hashes here.

File details

Details for the file compress-0.0.3-py2.py3-none-any.whl.

File metadata

  • Download URL: compress-0.0.3-py2.py3-none-any.whl
  • Upload date:
  • Size: 14.2 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.6.2

File hashes

Hashes for compress-0.0.3-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 dc71b23a773427fe5d2f26989549016d2dea3e01cdbb0af245f46241302e4651
MD5 20dd40a1911645cc019ca47cfeccb999
BLAKE2b-256 d7841c4dc83bd7384a3f4bfc3bb9627ab932b5062f6e29f6b69c02f06a333ed1

See more details on using hashes here.

Supported by

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