
Security News
npm Adopts OIDC for Trusted Publishing in CI/CD Workflows
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
Python bindings for ProllyTree - a probabilistic tree for efficient storage and retrieval
This directory contains Python bindings for the ProllyTree Rust library, providing a Pythonic interface to the probabilistic tree data structure.
maturin
build toolpip install maturin
cd /path/to/prollytree
maturin develop --features python
maturin build --release --features python
from prollytree import ProllyTree, TreeConfig
# Create an in-memory tree
tree = ProllyTree(storage_type="memory")
# Insert key-value pairs
tree.insert(b"key1", b"value1")
tree.insert(b"key2", b"value2")
# Batch insert
items = [(b"key3", b"value3"), (b"key4", b"value4")]
tree.insert_batch(items)
# Find values
value = tree.find(b"key1") # Returns b"value1"
# Update a value
tree.update(b"key1", b"new_value1")
# Delete keys
tree.delete(b"key2")
# Get tree properties
print(f"Size: {tree.size()}")
print(f"Depth: {tree.depth()}")
print(f"Root hash: {tree.get_root_hash().hex()}")
# Generate and verify Merkle proofs
proof = tree.generate_proof(b"key3")
is_valid = tree.verify_proof(proof, b"key3", b"value3")
# Compare trees
tree2 = ProllyTree()
tree2.insert(b"key1", b"different_value")
diff = tree.diff(tree2)
# File-based storage
config = TreeConfig(base=4, modulus=64)
file_tree = ProllyTree(storage_type="file", path="/tmp/my_tree", config=config)
file_tree.insert(b"persistent_key", b"persistent_value")
file_tree.save_config()
Configuration class for ProllyTree:
base
: Base for the rolling hash (default: 4)modulus
: Modulus for the rolling hash (default: 64)min_chunk_size
: Minimum chunk size (default: 1)max_chunk_size
: Maximum chunk size (default: 4096)pattern
: Pattern for chunk boundaries (default: 0)Main tree class with the following methods:
__init__(storage_type="memory", path=None, config=None)
: Create a new treeinsert(key: bytes, value: bytes)
: Insert a key-value pairinsert_batch(items: List[Tuple[bytes, bytes]])
: Batch insertfind(key: bytes) -> Optional[bytes]
: Find a value by keyupdate(key: bytes, value: bytes)
: Update an existing keydelete(key: bytes)
: Delete a keydelete_batch(keys: List[bytes])
: Batch deletesize() -> int
: Get number of key-value pairsdepth() -> int
: Get tree depthget_root_hash() -> bytes
: Get the root hashstats() -> Dict[str, int]
: Get tree statisticsgenerate_proof(key: bytes) -> bytes
: Generate a Merkle proofverify_proof(proof: bytes, key: bytes, expected_value: Optional[bytes]) -> bool
: Verify a proofdiff(other: ProllyTree) -> Dict
: Compare two treestraverse() -> str
: Get string representation of tree structuresave_config()
: Save tree configuration to storagecd python
python -m pytest tests/
cd python
python examples/basic_usage.py
Get API Tokens:
Set Environment Variables:
export MATURIN_PYPI_TOKEN="pypi-your-token-here"
# or for TestPyPI
export TEST_PYPI_API_TOKEN="pypi-your-test-token-here"
Test on TestPyPI first:
./publish_python.sh test
Publish to production PyPI:
./publish_python.sh prod
The repository includes a GitHub Actions workflow that automatically builds and publishes to PyPI when you push a version tag:
# Create and push a version tag
git tag v0.2.1
git push origin v0.2.1
Setup Required:
PYPI_API_TOKEN
to GitHub repository secretsUpdate version in pyproject.toml
before publishing:
[project]
version = "0.2.1" # Update this
FAQs
Python bindings for ProllyTree - a probabilistic tree for efficient storage and retrieval
We found that prollytree demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
Research
/Security News
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.
Security News
The CNA Scorecard ranks CVE issuers by data completeness, revealing major gaps in patch info and software identifiers across thousands of vulnerabilities.