Skip to content

leanEthereum/leanSnappy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages