Skip to content

jborean93/pyxca

Repository files navigation

Xpress Compression Library for Python

Test workflow PyPI version License

Implements Microsoft xpress compression for Python. The Xpress algorithm is defined under MS-XCA and encompasses 3 different algorithms

  • LZ77 - Not implemented
  • LZ77 + Huffman - Implemented
  • LZNT1 - Not implemented

Currently only the Xpress + Huffman algorithm is implemented with the code being based on what Microsoft themselves has provided under the MIT license.

⚠️ This library is experimental and is subject to change: Be very careful here!

Requirements

  • Python 3.6+
  • A C compiler, such as GCC

The compiler is only needed if installing from source/sdist, if using the wheel from PyPI then it should not be needed.

Installation

Simply run:

pip install xca

To install from source run the following:

git clone https://github.com/jborean93/pyxca.git
pip install Cython
python setup.py bdist_wheel
pip install dist/xca-*.whl

Development

To run the tests or make changes to this repo run the following:

git clone https://github.com/jborean93/pyxca.git
pip install -r requirements-dev.txt
pre-commit install

python setup.py build_ext --inplace

This will build the Cython and C code inplace where it can be imported by Python. From there an editor like VSCode can be used to make changes and run the test suite. To recompile the Cython files after a change run the build_ext --inplace command.

Examples

import xca

data = b"Hello World" * 1024
workspace = xca.XpressHuffman()

compressed_data = workspace.compress(data)

# The length of the plaintext should be communicated in some way to the decompressor
decompressed_data = workspace.decompress(compress_data, len(data))

Backlog

  • Implement Xpress/LZ77
  • Implement LZNT1
  • Do some performance testing

About

Python Library for MS-XCA Xpress Compression Algorithm

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published