Pure Python implementation of Google's Snappy compression algorithm.
uv syncfrom src import compress, decompress
# Compress data
data = b"Hello, World!" * 100
compressed = compress(data)
# Decompress data
original = decompress(compressed)
assert original == datacompress(data: bytes) -> bytes: Compress data using Snappydecompress(data: bytes) -> bytes: Decompress Snappy-compressed data
max_compressed_length(size: int) -> int: Maximum possible compressed sizeget_uncompressed_length(data: bytes) -> int: Read uncompressed length from headeris_valid_compressed_data(data: bytes) -> bool: Quick validation check
SnappyDecompressionError: Raised when decompression fails
# Install dependencies
uv sync
# Run tests
uv run pytest
# Run linter
uv run ruff check src/ tests/
# Format code
uv run ruff format src/ tests/MIT License