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.3.tar.gz (342.0 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.3-cp38-abi3-win_amd64.whl (5.4 MB view details)

Uploaded CPython 3.8+Windows x86-64

prollytree-0.3.3-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (6.3 MB view details)

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

prollytree-0.3.3-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (5.8 MB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ ARM64

prollytree-0.3.3-cp38-abi3-macosx_11_0_arm64.whl (5.3 MB view details)

Uploaded CPython 3.8+macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: prollytree-0.3.3.tar.gz
  • Upload date:
  • Size: 342.0 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.3.tar.gz
Algorithm Hash digest
SHA256 d197bdf45994ed011070508b96a13b965e7d5ad2194bc5191116727234f47de7
MD5 61fbc3810c05b19d71781e1830b077e3
BLAKE2b-256 9e498a489f606dc662f9e52c932e6180a67d79626b720310cd0872c140cee6ac

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: prollytree-0.3.3-cp38-abi3-win_amd64.whl
  • Upload date:
  • Size: 5.4 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.3-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 3689bbd03b12b10b69341ccf060c221bfa7ba65e66bdf57c7b0f7efa9a4757a0
MD5 76306a55d7fd6ef2272e6c659c8e5503
BLAKE2b-256 ea57b730baac76acb173890f2cfb6f37f93a69de39c80cdf8bf8b4322e487a32

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for prollytree-0.3.3-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 81fadbd92a83fd7addbf63a0b10d34899b9be5e40f53bb2e065146597c0d5062
MD5 d347355046a2f594e72b20346aa56547
BLAKE2b-256 8c7fadd562b0bf69d70d4eea0aace52cd4ab5e7e86a3dc27b52cb2dae151de43

See more details on using hashes here.

Provenance

The following attestation bundles were made for prollytree-0.3.3-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.3-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for prollytree-0.3.3-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 8a7055a637557cb45bbf5ad18710e5f542250aed03b0538accfba65b242a23c4
MD5 b79411b40db78e8798fda1781f263254
BLAKE2b-256 a488fd3846aa1724e334b21a16f21d5524abb7175adbe5ace6f33c029d407ae9

See more details on using hashes here.

Provenance

The following attestation bundles were made for prollytree-0.3.3-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.3-cp38-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for prollytree-0.3.3-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4469b61f4baed12c569ec1735c2c4555d3252f39e6998e93f5d9e84a4e06fede
MD5 10c517f13d25beec4114644364855da2
BLAKE2b-256 beea964071420c21895f416b63b42c7adbcb1bcf49140dd25b34b47fb482e010

See more details on using hashes here.

Provenance

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