LZMA C Decompressor for PythonThis project provides a high-performance C extension for Python to decompress LZMA data. It is designed as a lightweight, fast alternative for decompressing raw LZMA streams and can delegate to Python's built-in lzma library for the .xz container format.FeaturesHigh Performance: Written in C for significantly faster decompression compared to pure Python.Handles bytes and bytearray: Accepts both common byte sequence types as input.Supports Raw LZMA and .xz:Uses a custom C implementation for raw LZMA streams (FORMAT_ALONE).Delegates to the standard lzma library for the .xz container format, providing a robust, single-function solution.Easy Installation: Can be installed directly from a Git repository using pip.Installation from GitYou can install this module directly into your project from a Git repository (e.g., GitHub, GitLab) using pip. You will need a C compiler available on your system.Replace your-git-repository-url/project.git with the actual URL of your repository.pip install git+https://your-git-repository-url/project.git For example, if you host this on GitHub at https://github.com/user/lzma_c_decompressor:pip install git+https://github.com/user/lzma_c_decompressor.git UsageOnce installed, you can import and use the decompress function from the module.# test_module.py import lzma from lzma_decompressor.xz import decompress
original_data_xz = b"some xz compressed data" * 100 compressed_xz = lzma.compress(original_data_xz, format=lzma.FORMAT_XZ)
decompressed_data = decompress(compressed_xz) assert decompressed_data == original_data_xz
original_data_raw = b"some raw lzma data" * 100
compressed_raw = lzma.compress(original_data_raw, format=lzma.FORMAT_ALONE)
decompressed_data_raw = decompress(compressed_raw) assert decompressed_data_raw == original_data_raw
print("Decompression successful!")
DevelopmentTo build the module for local development:Clone the repository.Install dependencies and build the extension in place (this makes it importable in the current directory).# It's recommended to do this in a virtual environment pip install -e . This will compile lzma_decompressor.c and make it available in your environment for testing.