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.2.tar.gz (308.2 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.2-cp38-abi3-win_amd64.whl (5.2 MB view details)

Uploaded CPython 3.8+Windows x86-64

prollytree-0.3.2-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.9 MB view details)

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

prollytree-0.3.2-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (5.7 MB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ ARM64

prollytree-0.3.2-cp38-abi3-macosx_11_0_arm64.whl (5.1 MB view details)

Uploaded CPython 3.8+macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: prollytree-0.3.2.tar.gz
  • Upload date:
  • Size: 308.2 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.2.tar.gz
Algorithm Hash digest
SHA256 3b84f3219e4c485a603317e5f252bfa7b26cbbe011be5be97df907c2ed2bf3f1
MD5 4d7b2641df01c1a7107d86d6253c1caa
BLAKE2b-256 8eb39edb76028e10b6b166d1e928abcd98b0d029852f76dc6c40d2cb7b466b6e

See more details on using hashes here.

Provenance

The following attestation bundles were made for prollytree-0.3.2.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.2-cp38-abi3-win_amd64.whl.

File metadata

  • Download URL: prollytree-0.3.2-cp38-abi3-win_amd64.whl
  • Upload date:
  • Size: 5.2 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.2-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 d7e196138ec10490e84d0ee83c939215d3d6877d646f0f9b2a1248cebc5edc4b
MD5 768b71e190b7151fba1ec939c201bd5b
BLAKE2b-256 39d9d074e5ef83d616caa2394576b0c70bcf10a2cc4aabaf63beee489de8ea10

See more details on using hashes here.

Provenance

The following attestation bundles were made for prollytree-0.3.2-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.2-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for prollytree-0.3.2-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4e17d712434d51e79229f4faa4b1b82d72333ec2bbc0f22be7dd42b786dbf392
MD5 1944d128c156a1ada5baa99f032c45ec
BLAKE2b-256 52d0428c6bcea20fcf1b43d7ed74fc153d9d983f3487f7a5ce4ae641cfaa50ac

See more details on using hashes here.

Provenance

The following attestation bundles were made for prollytree-0.3.2-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_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.2-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for prollytree-0.3.2-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 78375604aee568ca20fa4f7b99bcb3b637ee1b9659c85ac1c485b22ac68d3156
MD5 e31c9a58115f5696a1a6acb8e3c8c287
BLAKE2b-256 cf573c09704fcf251accf53ac5f657d8a85db79ac2fb50fdd899341f84e28a11

See more details on using hashes here.

Provenance

The following attestation bundles were made for prollytree-0.3.2-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_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.2-cp38-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for prollytree-0.3.2-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9b5f4d2b7c49d23af170c27f5094a6ce5248cf95f47ab6441c063b231606d437
MD5 5ae9be8930b1ccfadda4e482e1daaa03
BLAKE2b-256 2f31da5553e9ba7c6eb360d3156123d6df03f5ea9770a68f8016d62b3c7631b9

See more details on using hashes here.

Provenance

The following attestation bundles were made for prollytree-0.3.2-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