KiteDB for Python
KiteDB is a high-performance embedded graph database with built-in vector search. This package provides the Python bindings to the Rust core.
Features
- ACID transactions with commit/rollback
- Node and edge CRUD operations with properties
- Labels, edge types, and property keys
- Fluent traversal and pathfinding (BFS, Dijkstra, A*)
- Vector embeddings with IVF and IVF-PQ indexes
- Single-file storage format
Install
From PyPI
pip install kitedb
From source
# Install maturin (Rust extension build tool)
python -m pip install -U maturin
# Build and install in development mode
maturin develop --features python
# Or build a wheel
maturin build --features python --release
pip install target/wheels/kitedb-*.whl
Quick start (fluent API)
The fluent API provides a high-level, type-safe interface:
from kitedb import kite, node, edge, prop, optional
# Define your schema
User = node("user",
key=lambda id: f"user:{id}",
props={
"name": prop.string("name"),
"email": prop.string("email"),
"age": optional(prop.int("age")),
}
)
Knows = edge("knows", {
"since": prop.int("since"),
})
# Open database
with kite("./social.kitedb", nodes=[User], edges=[Knows]) as db:
# Insert nodes
alice = db.insert(User).values(key="alice", name="Alice", email="alice@example.com").returning()
bob = db.insert(User).values(key="bob", name="Bob", email="bob@example.com").returning()
# Create edges
db.link(alice, Knows, bob, since=2024)
# Traverse
friends = db.from_(alice).out(Knows).nodes().to_list()
# Pathfinding
path = db.shortest_path(alice).via(Knows).to(bob).dijkstra()
Quick start (low-level API)
For direct control, use the low-level Database class:
from kitedb import Database, PropValue
with Database("my_graph.kitedb") as db:
db.begin()
alice = db.create_node("user:alice")
bob = db.create_node("user:bob")
name_key = db.get_or_create_propkey("name")
db.set_node_prop(alice, name_key, PropValue.string("Alice"))
db.set_node_prop(bob, name_key, PropValue.string("Bob"))
knows = db.get_or_create_etype("knows")
db.add_edge(alice, knows, bob)
db.commit()
print("nodes:", db.count_nodes())
print("edges:", db.count_edges())
Bulk ingest (max throughput)
Use bulk-load transactions + batch APIs to maximize write throughput. Bulk-load disables MVCC, so avoid concurrent readers/writers while it runs.
from kitedb import Database
db = Database("my_graph.kitedb")
db.begin_bulk()
node_ids = db.create_nodes_batch(keys) # keys: List[Optional[str]]
db.add_edges_batch(edges) # edges: List[Tuple[int, int, int]]
db.add_edges_with_props_batch(edges_with_props)
db.commit()
Fluent traversal
from kitedb import TraverseOptions
friends = db.from_(alice).out(knows).to_list()
results = db.from_(alice).traverse(
knows,
TraverseOptions(max_depth=3, min_depth=1, direction="out", unique=True),
).to_list()
Concurrent Access
KiteDB supports concurrent read operations from multiple threads. Read operations don't block each other:
import threading
from concurrent.futures import ThreadPoolExecutor
# Multiple threads can read concurrently
def read_user(key):
return db.get_node_by_key(key)
with ThreadPoolExecutor(max_workers=4) as executor:
futures = [executor.submit(read_user, f"user:{i}") for i in range(100)]
results = [f.result() for f in futures]
# Or with asyncio (reads run concurrently)
import asyncio
async def read_users():
loop = asyncio.get_event_loop()
tasks = [
loop.run_in_executor(None, db.get_node_by_key, f"user:{i}")
for i in range(100)
]
return await asyncio.gather(*tasks)
Concurrency model:
- Reads are concurrent: Multiple
get_node_by_key(),get_neighbors(), traversals, etc. can run in parallel - Writes are exclusive: Write operations (
create_node(),add_edge(), etc.) require exclusive access - Thread safety: The
Databaseobject is safe to share across threads
Note: Python's GIL is released during Rust operations, allowing true parallelism for I/O-bound database access.
Vector search
from kitedb import IvfIndex, IvfConfig, SearchOptions
index = IvfIndex(dimensions=128, config=IvfConfig(n_clusters=100))
training_data = [0.1] * (128 * 1000)
index.add_training_vectors(training_data, num_vectors=1000)
index.train()
index.insert(vector_id=1, vector=[0.1] * 128)
results = index.search(
manifest_json='{"vectors": {...}}',
query=[0.1] * 128,
k=10,
options=SearchOptions(n_probe=20),
)
for result in results:
print(result.node_id, result.distance)
Replication admin (low-level API)
Phase D replication controls are available on Database:
from kitedb import (
Database,
OpenOptions,
collect_replication_log_transport_json,
collect_replication_metrics_otel_json,
collect_replication_metrics_prometheus,
collect_replication_snapshot_transport_json,
push_replication_metrics_otel_json,
)
primary = Database(
"cluster-primary.kitedb",
OpenOptions(
replication_role="primary",
replication_sidecar_path="./cluster-primary.sidecar",
replication_segment_max_bytes=64 * 1024 * 1024,
replication_retention_min_entries=1024,
),
)
primary.begin()
primary.create_node("n:1")
token = primary.commit_with_token()
primary.primary_report_replica_progress("replica-a", 1, 42)
pruned_segments, retained_floor = primary.primary_run_retention()
primary_status = primary.primary_replication_status()
replica = Database(
"cluster-replica.kitedb",
OpenOptions(
replication_role="replica",
replication_sidecar_path="./cluster-replica.sidecar",
replication_source_db_path="cluster-primary.kitedb",
replication_source_sidecar_path="./cluster-primary.sidecar",
),
)
replica.replica_bootstrap_from_snapshot()
replica.replica_catch_up_once(256)
if token:
replica.wait_for_token(token, 2000)
replica_status = replica.replica_replication_status()
if replica_status and replica_status["needs_reseed"]:
replica.replica_reseed_from_snapshot()
prometheus = collect_replication_metrics_prometheus(primary)
print(prometheus)
otel_json = collect_replication_metrics_otel_json(primary)
print(otel_json)
status_code, response_body = push_replication_metrics_otel_json(
primary,
"http://127.0.0.1:4318/v1/metrics",
timeout_ms=5000,
)
print(status_code, response_body)
secure_status, secure_body = push_replication_metrics_otel_json(
primary,
"https://collector.internal:4318/v1/metrics",
timeout_ms=5000,
https_only=True,
ca_cert_pem_path="./tls/collector-ca.pem",
client_cert_pem_path="./tls/client.pem",
client_key_pem_path="./tls/client-key.pem",
)
print(secure_status, secure_body)
snapshot_json = collect_replication_snapshot_transport_json(primary, include_data=False)
print(snapshot_json)
log_json = collect_replication_log_transport_json(
primary,
cursor=None,
max_frames=128,
max_bytes=1024 * 1024,
include_payload=False,
)
print(log_json)
replica.close()
primary.close()
Documentation
https://kitedb.vercel.com/docs
License
MIT License - see the main project LICENSE file for details.
Metadata
Release files for kitedb 0.2.18
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| kitedb-0.2.18.tar.gz | 1.8 MB | Details |
Built distributions (wheels)
Total release size: 64.3 MB
Release files / kitedb-0.2.18.tar.gz
| Download URL | kitedb-0.2.18.tar.gz |
|---|---|
| Size | 1.8 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3ae2bf5f9c73359a955a535827015b6fc3264ed583dad8862718a38b24431e28
|
|
BLAKE2b-256 checksum How to use checksums |
1d5a21ae3996cc8ae67542e0161d53a90edbf266c4370af3a5284fb95fed7124
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.11.5
|
Release files / kitedb-0.2.18-cp313-cp313-win_amd64.whl
| Download URL | kitedb-0.2.18-cp313-cp313-win_amd64.whl |
|---|---|
| Size | 3.2 MB |
| Tags | CPython 3.13 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
c1cbf9681078571667b5a5d895a1583af4f256a24acf7852370a458ce881b90d
|
|
BLAKE2b-256 checksum How to use checksums |
03c91d3cd14399af6fc9c17260b2c2864c6daf8fe9ab6b6e8facbaaa1641ebb9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.11.5
|
Release files / kitedb-0.2.18-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | kitedb-0.2.18-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 3.3 MB |
| Tags | CPython 3.13 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
4cc69368f802ab3d9cdeb917a65fbf950ffacbac55a8cc6e88ce47345f82e461
|
|
BLAKE2b-256 checksum How to use checksums |
a06a66e3916160fbdbf6cb23ec4fd358f1d0cd42388b507ba89260887d44c9d9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.11.5
|
Release files / kitedb-0.2.18-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | kitedb-0.2.18-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 3.1 MB |
| Tags | CPython 3.13 Linux glibc 2.17+ ARM64 |
|
SHA-256 checksum How to use checksums |
d8733c401b5b51f08cecec632308e81b1d2953166cc0bfbf95b1a68a26dab438
|
|
BLAKE2b-256 checksum How to use checksums |
d7b15e1dca9f0e56ff7ad5a0999a3d2112dc3e9c345ac6b68d21b125df8e78e8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.11.5
|
Release files / kitedb-0.2.18-cp313-cp313-macosx_11_0_arm64.whl
| Download URL | kitedb-0.2.18-cp313-cp313-macosx_11_0_arm64.whl |
|---|---|
| Size | 2.9 MB |
| Tags | CPython 3.13 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
42ad900b79378d920a97c1322ada14fe271b4b9f46474cefacd0dfc394b9b41f
|
|
BLAKE2b-256 checksum How to use checksums |
380aea03d0039eab57442bf44a492264e62751986c30395f2b123d272794c502
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.11.5
|
Release files / kitedb-0.2.18-cp312-cp312-win_amd64.whl
| Download URL | kitedb-0.2.18-cp312-cp312-win_amd64.whl |
|---|---|
| Size | 3.2 MB |
| Tags | CPython 3.12 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
7db8c46428c48ccb6ce7c74e71816db50b683cfcd95d2564d786c452d4d336fd
|
|
BLAKE2b-256 checksum How to use checksums |
42d50c2a1df9d4ec24719dbea488888ee4d44c8724b636bd5d71babf73878a20
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.11.5
|
Release files / kitedb-0.2.18-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | kitedb-0.2.18-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 3.3 MB |
| Tags | CPython 3.12 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
e0e88611111ea42da10a353865754852016f2b169da1624683df164f766151a7
|
|
BLAKE2b-256 checksum How to use checksums |
98a06f383eb336fcf257b925c213501a99401130fcca36353f0083e7317446fe
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.11.5
|
Release files / kitedb-0.2.18-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | kitedb-0.2.18-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 3.1 MB |
| Tags | CPython 3.12 Linux glibc 2.17+ ARM64 |
|
SHA-256 checksum How to use checksums |
860978f1b7148811d3ded03ef798e216d78d4d455d846988718699c605732c36
|
|
BLAKE2b-256 checksum How to use checksums |
c9185f9e09c28a0ce4af7117d416f8730b88a78eb0b4b12095659b12a185536e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.11.5
|
Release files / kitedb-0.2.18-cp312-cp312-macosx_11_0_arm64.whl
| Download URL | kitedb-0.2.18-cp312-cp312-macosx_11_0_arm64.whl |
|---|---|
| Size | 2.9 MB |
| Tags | CPython 3.12 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
19beebfd2073c26fef6629e460359939647fac9ba1e201e02ca8dfc1019ce80f
|
|
BLAKE2b-256 checksum How to use checksums |
5fd2003598d6cfe9b0bc1d513bd4848f9723afc07e141056ee7a1121bd1a0fff
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.11.5
|
Release files / kitedb-0.2.18-cp311-cp311-win_amd64.whl
| Download URL | kitedb-0.2.18-cp311-cp311-win_amd64.whl |
|---|---|
| Size | 3.2 MB |
| Tags | CPython 3.11 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
87a2ebd83f263b0268fbdc5dfcdb65140d1419377b32cd39f2bc26a6cb72d0c3
|
|
BLAKE2b-256 checksum How to use checksums |
886bdaae25bc157da8a734efc56174bb04b7b1b77ebb7afc16d3740b82d18ae0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.11.5
|
Release files / kitedb-0.2.18-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | kitedb-0.2.18-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 3.3 MB |
| Tags | CPython 3.11 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
963a777e50962e87528ca0e7f224e0e640941aac2a90918b0f70529bbdb34674
|
|
BLAKE2b-256 checksum How to use checksums |
e19b849f602760be8a50067bcfd00b7b11e9c7b3ecb29cf6ed1d522465dfaa0e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.11.5
|
Release files / kitedb-0.2.18-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | kitedb-0.2.18-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 3.1 MB |
| Tags | CPython 3.11 Linux glibc 2.17+ ARM64 |
|
SHA-256 checksum How to use checksums |
4a8b1cae6821d8c872cae34372f0ec1d8b627deb56fa91e51a43eb995e910296
|
|
BLAKE2b-256 checksum How to use checksums |
0b219398a300f7803d79cca7f8bee06f7ed8505e31f72b45d65aeb39bf74f657
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.11.5
|
Release files / kitedb-0.2.18-cp311-cp311-macosx_11_0_arm64.whl
| Download URL | kitedb-0.2.18-cp311-cp311-macosx_11_0_arm64.whl |
|---|---|
| Size | 2.9 MB |
| Tags | CPython 3.11 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
6525fd29341dc6df41ce1e9194b4e58fd8bedeb5f199e09b05d71707fb83b5e7
|
|
BLAKE2b-256 checksum How to use checksums |
be6030747caa67bdc09d1d62679ebee8e1a8723a4911933c250b7078bc62bfa8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.11.5
|
Release files / kitedb-0.2.18-cp310-cp310-win_amd64.whl
| Download URL | kitedb-0.2.18-cp310-cp310-win_amd64.whl |
|---|---|
| Size | 3.2 MB |
| Tags | CPython 3.10 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
1134e5bd71d7ec087ca19480744bb416df76fcd8a65848e5d47d63b06ce3f96e
|
|
BLAKE2b-256 checksum How to use checksums |
b51a0e7dff17bd04827b7f8b8930da538fef4b1349a46f85dcfc8fb554f29376
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.11.5
|
Release files / kitedb-0.2.18-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | kitedb-0.2.18-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 3.3 MB |
| Tags | CPython 3.10 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
10e28d2c1881bc7d3163361beca15412762de7a80211351ab0be121fd15309e7
|
|
BLAKE2b-256 checksum How to use checksums |
b971ce73cec19544783522a31f9ac4ffdb8ccf5770317509211e2ca3d94851f5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.11.5
|
Release files / kitedb-0.2.18-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | kitedb-0.2.18-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 3.1 MB |
| Tags | CPython 3.10 Linux glibc 2.17+ ARM64 |
|
SHA-256 checksum How to use checksums |
70f8cd6b76bbf401a513c5d7a34dc7340ea3d4471037074b650845ced260e7c5
|
|
BLAKE2b-256 checksum How to use checksums |
27f002ac6bad259a9670aea76c29561192944b4d1900fa93cbde124032208f65
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.11.5
|
Release files / kitedb-0.2.18-cp310-cp310-macosx_11_0_arm64.whl
| Download URL | kitedb-0.2.18-cp310-cp310-macosx_11_0_arm64.whl |
|---|---|
| Size | 2.9 MB |
| Tags | CPython 3.10 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
b2eff091dd6c73532c2de30b18c344655cf3918e7651f9be478f10bb6dcacd3e
|
|
BLAKE2b-256 checksum How to use checksums |
1f26d566227690ac6c8c40b6d3aa689336ffd7fac3c835144ab83516571636b3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.11.5
|
Release files / kitedb-0.2.18-cp39-cp39-win_amd64.whl
| Download URL | kitedb-0.2.18-cp39-cp39-win_amd64.whl |
|---|---|
| Size | 3.2 MB |
| Tags | CPython 3.9 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
0922a524b215b2fdb25d47f94a08c0d25b9fdd3d9da2ebddebd15092a4f1a082
|
|
BLAKE2b-256 checksum How to use checksums |
71b3d284adfabd9ae1ef564bb89300a5f53d9c5c603a59f483ebf6346419c532
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.11.5
|
Release files / kitedb-0.2.18-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | kitedb-0.2.18-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 3.3 MB |
| Tags | CPython 3.9 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
6f59ea194591c177264cda96050450f8a11910b2f6b4a3d6b092fbdd797cdc3d
|
|
BLAKE2b-256 checksum How to use checksums |
f5d7ff688ccc5198983c322dcf374bc7bb7d546d32a5389472460788b04da952
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.11.5
|
Release files / kitedb-0.2.18-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | kitedb-0.2.18-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 3.1 MB |
| Tags | CPython 3.9 Linux glibc 2.17+ ARM64 |
|
SHA-256 checksum How to use checksums |
229922f0d1891f8604886f8033caac262307adbc06ed19e4e7c06a63605d21d6
|
|
BLAKE2b-256 checksum How to use checksums |
9c72cfbc025f15bc7953a61032b333db6ece6f7058acffeed5411a5eb3e461bf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.11.5
|
Release files / kitedb-0.2.18-cp39-cp39-macosx_11_0_arm64.whl
| Download URL | kitedb-0.2.18-cp39-cp39-macosx_11_0_arm64.whl |
|---|---|
| Size | 2.9 MB |
| Tags | CPython 3.9 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
280fd0c24a6cdd355b49700876c5f68084c56829ee432fbbec76c2d2db5e999b
|
|
BLAKE2b-256 checksum How to use checksums |
cc215137bd486e78ddcc0890605212660b3f7f83bccd2766324d34e516de32be
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.11.5
|