Skip to content

Latest commit

 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

leanSnappy

Pure Python implementation of Google's Snappy compression algorithm.

Installation

uv sync

Usage

from src import compress, decompress

# Compress data
data = b"Hello, World!" * 100
compressed = compress(data)

# Decompress data
original = decompress(compressed)
assert original == data

API

Core Functions

  • compress(data: bytes) -> bytes: Compress data using Snappy
  • decompress(data: bytes) -> bytes: Decompress Snappy-compressed data

Utilities

  • max_compressed_length(size: int) -> int: Maximum possible compressed size
  • get_uncompressed_length(data: bytes) -> int: Read uncompressed length from header
  • is_valid_compressed_data(data: bytes) -> bool: Quick validation check

Exceptions

  • SnappyDecompressionError: Raised when decompression fails

Development

# 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/

References

License

MIT License

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages