Apple-Compress

0.2.3 · active · verified Thu Apr 16

apple-compress provides Python bindings for Apple's native libcompression framework. This library allows Python applications to utilize the highly optimized compression and decompression algorithms available on Apple operating systems (macOS, iOS, etc.). As of April 2026, the current version is 0.2.3. The release cadence is infrequent, typically aligned with bug fixes or minor enhancements rather than a strict schedule.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to compress and decompress a byte string using the LZFSE algorithm. The library typically exposes `compress` and `decompress` functions along with algorithm constants like `LZFSE` or `ZLIB`.

import apple_compress

original_data = b"This is some data to be compressed by apple-compress using LZFSE!"
print(f"Original data length: {len(original_data)} bytes")

# Compress data using the LZFSE algorithm
compressed_data = apple_compress.compress(original_data, algorithm=apple_compress.LZFSE)
print(f"Compressed data length: {len(compressed_data)} bytes")
print(f"Compressed data (first 50 bytes): {compressed_data[:50]}...")

# Decompress data using the same algorithm
decompressed_data = apple_compress.decompress(compressed_data, algorithm=apple_compress.LZFSE)
print(f"Decompressed data length: {len(decompressed_data)} bytes")

assert original_data == decompressed_data
print("Decompression successful! Original and decompressed data match.")

view raw JSON →