Skip to main content

Python bindings for ProllyTree - a probabilistic tree for efficient storage and retrieval

Project description

ProllyTree Python Bindings

Documentation PyPI

Python bindings for ProllyTree - a probabilistic tree data structure that combines B-trees and Merkle trees for efficient, verifiable data storage.

Quick Start

Installation

pip install prollytree

Basic Usage

from prollytree import ProllyTree

# Create a tree and insert data
tree = ProllyTree()
tree.insert(b"hello", b"world")
value = tree.find(b"hello")  # Returns b"world"

Documentation

Complete Documentation

The full documentation includes:

Features

  • Probabilistic Trees - High-performance data storage with automatic balancing
  • Versioned Storage - Git-like version control for key-value data
  • Multiple Storage Backends - Choose from Git, File, InMemory, or RocksDB storage
  • Cryptographic Verification - Merkle proofs for data integrity across trees and versioned storage
  • SQL Queries - Query your data using SQL syntax

Key Use Cases

Probabilistic Trees

from prollytree import ProllyTree

tree = ProllyTree()
tree.insert(b"user:123", b"Alice")
tree.insert(b"user:456", b"Bob")

# Cryptographic verification
proof = tree.generate_proof(b"user:123")
is_valid = tree.verify_proof(proof, b"user:123", b"Alice")

Versioned Storage

from prollytree import VersionedKvStore, StorageBackend

# Default Git backend (recommended for full version control)
store = VersionedKvStore("./data")

# Or explicitly choose a storage backend
store = VersionedKvStore("./data", StorageBackend.Git)      # Full git versioning
store = VersionedKvStore("./data", StorageBackend.File)     # File-based storage
store = VersionedKvStore("./data", StorageBackend.InMemory) # In-memory (volatile)
store = VersionedKvStore("./data", StorageBackend.RocksDB)  # RocksDB (requires rocksdb_storage feature)

# Basic operations
store.insert(b"config", b"production_settings")
commit_id = store.commit("Add production config")

# Branch and experiment
store.create_branch("experiment")
store.insert(b"feature", b"experimental_data")
store.commit("Add experimental feature")

# Merge branches (Git backend only)
store.checkout("main")
store.merge("experiment")

# Diff between branches (Git backend only)
diffs = store.diff("main", "experiment")
for diff in diffs:
    print(f"Key: {diff.key}, Operation: {diff.operation}")

# Cryptographic verification on versioned data
proof = store.generate_proof(b"config")
is_valid = store.verify_proof(proof, b"config", b"production_settings")

SQL Queries

from prollytree import ProllySQLStore

sql_store = ProllySQLStore("./database")
sql_store.execute("CREATE TABLE users (id INT, name TEXT)")
sql_store.execute("INSERT INTO users VALUES (1, 'Alice')")
results = sql_store.execute("SELECT * FROM users WHERE name = 'Alice'")

Development

Building from Source

git clone https://github.com/zhangfengcdt/prollytree
cd prollytree
./python/build_python.sh --all-features --install

Running Tests

cd python/tests
python test_prollytree.py

License

Licensed under the Apache License, Version 2.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

prollytree-0.3.4.tar.gz (344.6 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

prollytree-0.3.4-cp38-abi3-win_amd64.whl (7.7 MB view details)

Uploaded CPython 3.8+Windows x86-64

prollytree-0.3.4-cp38-abi3-manylinux_2_28_x86_64.whl (9.9 MB view details)

Uploaded CPython 3.8+manylinux: glibc 2.28+ x86-64

prollytree-0.3.4-cp38-abi3-manylinux_2_28_aarch64.whl (5.8 MB view details)

Uploaded CPython 3.8+manylinux: glibc 2.28+ ARM64

prollytree-0.3.4-cp38-abi3-macosx_11_0_arm64.whl (8.0 MB view details)

Uploaded CPython 3.8+macOS 11.0+ ARM64

File details

Details for the file prollytree-0.3.4.tar.gz.

File metadata

  • Download URL: prollytree-0.3.4.tar.gz
  • Upload date:
  • Size: 344.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for prollytree-0.3.4.tar.gz
Algorithm Hash digest
SHA256 0c761fb5f87993e467c97a6ad2193b3f0b57d8f6bf9938ff2d442b45d38c7b40
MD5 14a623b03e260ba117d3621bf8d83f41
BLAKE2b-256 2cdafcc8f92d97137b4c9ee71660cc9fde70475de2d903af98300b1feed4717a

See more details on using hashes here.

Provenance

The following attestation bundles were made for prollytree-0.3.4.tar.gz:

Publisher: release.yml on zhangfengcdt/prollytree

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file prollytree-0.3.4-cp38-abi3-win_amd64.whl.

File metadata

  • Download URL: prollytree-0.3.4-cp38-abi3-win_amd64.whl
  • Upload date:
  • Size: 7.7 MB
  • Tags: CPython 3.8+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for prollytree-0.3.4-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 5e5666f47a1a6b7f3fd7c49179eb47fd8a77be42a09295dbc0dbca8c6577c13f
MD5 1adcefbbe0534b236e41a3ce82b525ed
BLAKE2b-256 4f731f391f63aaf7125cc90c05d8b3872bd04e0f3408d7d8d050948f50e95b00

See more details on using hashes here.

Provenance

The following attestation bundles were made for prollytree-0.3.4-cp38-abi3-win_amd64.whl:

Publisher: release.yml on zhangfengcdt/prollytree

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file prollytree-0.3.4-cp38-abi3-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for prollytree-0.3.4-cp38-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 27bc7d44228587fd09a2fa120cf569bf28d02073c09264b18da2cf4f0b245b45
MD5 4ecc1a9ebdc0354d3a7f2d17db779ab4
BLAKE2b-256 40159767de3192aa830afdc6436f8564bc98ebac996b7d9be6996b09db243b11

See more details on using hashes here.

Provenance

The following attestation bundles were made for prollytree-0.3.4-cp38-abi3-manylinux_2_28_x86_64.whl:

Publisher: release.yml on zhangfengcdt/prollytree

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file prollytree-0.3.4-cp38-abi3-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for prollytree-0.3.4-cp38-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 627b8a587f4f560af8dbcd2777defd6c6de16ab50e637ec47e8e4a99799b03b2
MD5 d75237b928e6f7276f95d6cb641a1bcf
BLAKE2b-256 516caf2777e3635cda1d305100a03844ae2cf44c8bd94b0d3ed52fe2465f59a1

See more details on using hashes here.

Provenance

The following attestation bundles were made for prollytree-0.3.4-cp38-abi3-manylinux_2_28_aarch64.whl:

Publisher: release.yml on zhangfengcdt/prollytree

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file prollytree-0.3.4-cp38-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for prollytree-0.3.4-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8b726c206f276f3ce3853bdab66f62c7b6ca1abc1c8da26856eb62720b152bd2
MD5 e75e4b9014f2bd7c1a07594c2f8bf289
BLAKE2b-256 19e599a23cd903623ee5228506a699b448eb1f5ffc94fb28f459136efce51bf5

See more details on using hashes here.

Provenance

The following attestation bundles were made for prollytree-0.3.4-cp38-abi3-macosx_11_0_arm64.whl:

Publisher: release.yml on zhangfengcdt/prollytree

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page