All in one data compression library.
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.
- lzma, high compression ratio but slow (it’s part of standard library after Python3.4, you can use backports.lzma for versions before that.)
- pylzma, another implementation, faster in decompression than lzma.
- snappy, from Google, lower compression ratio but super fast!
- lz4, lower ratio, super fast!
some package are not installed along with compress. Because all of them needs C compiler, you have to manually install them. If you have trouble installing C compiler for your OS, read THIS TUTORIAL.
>>> from compress import Compressor >>> c = Compressor() >>> c.use_zlib() # or use_bz2, use_lzma, use_lz4, use_snappy >>> c.compress(binary_data, zlib_level=9) >>> c.decompress(binary_data)
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:
make up make benchmark
If you use Windows (doesn’t have make command), this is the SOLUTION
Of course, you can extend with your own test case (How to extend test case).
compress is released on PyPI, so all you need is:
$ pip install compress
To upgrade to latest version:
$ pip install --upgrade compress
to install lzma, snappy, lz4 for python, it may requires gcc comiler. If you are using Windows,
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size compress-0.0.2-py2-none-any.whl (46.6 kB)||File type Wheel||Python version py2||Upload date||Hashes View|
|Filename, size compress-0.0.2.tar.gz (25.3 kB)||File type Source||Python version None||Upload date||Hashes View|