LZW is an archive format that utilize power of LZW compression algorithm. LZW compression algorithm is a dictionary-based loseless algorithm. It's an old algorithm suitable for beginner to practice.
Internal algorithm processes byte data. So it's applicable to any file types, besides text file. Although it may not be able to achieve substantial compression rate for some file types that are already compressed efficiently, such as PDF files and MP4 files.
Prerequisites: Python>=3.8, Git, pip.
One-liner installation recipe:
$ python -m pip install git+https://github.com/MapleCCC/LZW-Compressor.git#egg=LZW-Compressor
If editable mode installation is preferred:
# You can optionally create a virtual environment for isolation purpose
$ python -m virtualenv .venv
$ source .venv/Scripts/activate
# Install in editable mode
$ python -m pip install -e git+https://github.com/MapleCCC/LZW-Compressor.git#egg=LZW-Compressor
Use as command line tool:
# Compression
$ lzw compress [-o|--output <ARCHIVE>] <FILES>...
# Decompression
$ lzw decompress <ARCHIVE>
Use as module:
from LZW import lzw_compress, lzw_decompress
lzw_compress("a.lzw", "file1", "file2")
lzw_decompress("a.lzw")
The project uses pytest and hypothesis as test framework. Property-based testing is adopted in favor of its flexibility and conciseness.
# Install test requirements
$ python -m pip install -r requirements-test.txt
# Base test
$ make test
# Test coverage
$ make test-cov
[TODO]