Skip to main content

High-performance embedded graph database with vector search

Project description

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 Database object 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)

Documentation

https://kitedb.vercel.com/docs

License

MIT License - see the main project LICENSE file for details.

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

kitedb-0.2.15.tar.gz (1.7 MB view details)

Uploaded Source

Built Distributions

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

kitedb-0.2.15-cp313-cp313-win_amd64.whl (1.4 MB view details)

Uploaded CPython 3.13Windows x86-64

kitedb-0.2.15-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.5 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

kitedb-0.2.15-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.4 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ ARM64

kitedb-0.2.15-cp313-cp313-macosx_11_0_arm64.whl (1.3 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

kitedb-0.2.15-cp312-cp312-win_amd64.whl (1.4 MB view details)

Uploaded CPython 3.12Windows x86-64

kitedb-0.2.15-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.5 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

kitedb-0.2.15-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.4 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64

kitedb-0.2.15-cp312-cp312-macosx_11_0_arm64.whl (1.3 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

kitedb-0.2.15-cp311-cp311-win_amd64.whl (1.4 MB view details)

Uploaded CPython 3.11Windows x86-64

kitedb-0.2.15-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.5 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

kitedb-0.2.15-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.4 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ ARM64

kitedb-0.2.15-cp311-cp311-macosx_11_0_arm64.whl (1.3 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

kitedb-0.2.15-cp310-cp310-win_amd64.whl (1.4 MB view details)

Uploaded CPython 3.10Windows x86-64

kitedb-0.2.15-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.5 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

kitedb-0.2.15-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.4 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ ARM64

kitedb-0.2.15-cp310-cp310-macosx_11_0_arm64.whl (1.3 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

kitedb-0.2.15-cp39-cp39-win_amd64.whl (1.4 MB view details)

Uploaded CPython 3.9Windows x86-64

kitedb-0.2.15-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.5 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

kitedb-0.2.15-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.4 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ ARM64

kitedb-0.2.15-cp39-cp39-macosx_11_0_arm64.whl (1.3 MB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

File details

Details for the file kitedb-0.2.15.tar.gz.

File metadata

  • Download URL: kitedb-0.2.15.tar.gz
  • Upload date:
  • Size: 1.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.11.5

File hashes

Hashes for kitedb-0.2.15.tar.gz
Algorithm Hash digest
SHA256 f6e6aa8dc918a302dcfd8fce38977f4a38b97f99273fd18846927e985aaa067c
MD5 d616545f02195f070d134104bf7929aa
BLAKE2b-256 aa9373d2b2df72ef04e0878f17cc239f1cc2ab2b8bc7e5c63b7966cfe19d1882

See more details on using hashes here.

File details

Details for the file kitedb-0.2.15-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: kitedb-0.2.15-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 1.4 MB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.11.5

File hashes

Hashes for kitedb-0.2.15-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 b17a844f4ea63779cd183dea47e82e2b1373c4fe080803e6cfa99491ef9afae0
MD5 cc883afbfbe27a7c6e1488229faef8a2
BLAKE2b-256 02abb1e2691434637c9eb68b26a361fe161067d806d59cfd8b44fad1f3889ef5

See more details on using hashes here.

File details

Details for the file kitedb-0.2.15-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for kitedb-0.2.15-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9617754b4b463494c527a07802afd76b0e53abd1e2656e29339e19156052c4cc
MD5 682684e15a890850becf5a8452f3fd11
BLAKE2b-256 fa2b926392eb62d5a99b28962c781ec37b3710d49461e87b41f52fcfb591c525

See more details on using hashes here.

File details

Details for the file kitedb-0.2.15-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for kitedb-0.2.15-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 7370b7e3c5a90e5d875dc429abd67893108b8b1d5ededaff66d593760f3096be
MD5 a465e3d0b85b5d2e01bc872df8effec4
BLAKE2b-256 713a0f44f8756d163f5638cd77fea91b7071bc33ce481b224e3a0d9f557f177f

See more details on using hashes here.

File details

Details for the file kitedb-0.2.15-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for kitedb-0.2.15-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4c6d95ef418dfdba05d149af867b89cdb3328b186ce33ec5964d7a1098ca0e9a
MD5 8f2bd3c38bb046f024d6fb7d0f44fd04
BLAKE2b-256 2cad0081ca2c3339c188d5372176301d7c45720be4fbb1310a13a43f168e7ace

See more details on using hashes here.

File details

Details for the file kitedb-0.2.15-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: kitedb-0.2.15-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 1.4 MB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.11.5

File hashes

Hashes for kitedb-0.2.15-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 4ab5d941ebd2e9d18b02fdf1d2c01ce356b79b4ca90e4212128b5cba88cd2820
MD5 c62172a36f02cc1580f18535711480d6
BLAKE2b-256 698aa0abbf7264675801564486806969c9801c04e0907b3a65c9c6190af82666

See more details on using hashes here.

File details

Details for the file kitedb-0.2.15-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for kitedb-0.2.15-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1654698a95cbbaf9b4392620533a8c2abbfca83e23534d9fdd8b03eeab85df7c
MD5 9f0138e8ae685a8a552ccd5c1e3c832f
BLAKE2b-256 dba4c50731b5ac94948f20e2a8fbbd5aa1324b0efa9bfc112382d514d68d2abe

See more details on using hashes here.

File details

Details for the file kitedb-0.2.15-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for kitedb-0.2.15-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 083b1c37dd5b74970d4b560d2bf9a5fb0e685716a2e7beddc11acc61a913112b
MD5 eb5913c6e9ce2afbff0c623802825935
BLAKE2b-256 19ec058d67148b4e21596a7dddefa8ad1f795efc4e5669fc4a0a6812b2aa137e

See more details on using hashes here.

File details

Details for the file kitedb-0.2.15-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for kitedb-0.2.15-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 846247399158b5a52b86f7c888b679a7c9430b9ae6f94da29b8b95c673b4404c
MD5 9b84e00c51c79694887e9ede81e710da
BLAKE2b-256 1752917208877120b920669554bac87d167cfd83c900f7e08b4a2a0973c8344f

See more details on using hashes here.

File details

Details for the file kitedb-0.2.15-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: kitedb-0.2.15-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 1.4 MB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.11.5

File hashes

Hashes for kitedb-0.2.15-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 b38a5b5df9d76b2974deb86771515583f5bdd88eb568c6327a5b3aa810707a6f
MD5 4898c2d7ce8e5a839d4ddb12a0489944
BLAKE2b-256 5477a4cf37347833a4aa6bd1f1c4e2a6d7456e5eb469672ff0f4e6280785e563

See more details on using hashes here.

File details

Details for the file kitedb-0.2.15-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for kitedb-0.2.15-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9b4fef9085f26533d2b300406ca8d3317db03870c95e93a6594431fc4b0d9134
MD5 7cb21222ffbcd10c1d81ff56073e9174
BLAKE2b-256 b9ab5c4f16dad72636309a27b502d6416b8a7363756cd3711e439f9b6f474899

See more details on using hashes here.

File details

Details for the file kitedb-0.2.15-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for kitedb-0.2.15-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 61c69d312e69db17b589f6a202b1ce8e48a248a85915d4881803e36fa6bd91f8
MD5 bb3d8ad979cbd81faca13dedfb663b59
BLAKE2b-256 d3f6255af274c71ea0d31cbdd52e111a02f4f701b5521e9e0cf6d37ea74e4ded

See more details on using hashes here.

File details

Details for the file kitedb-0.2.15-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for kitedb-0.2.15-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a9fdbf78131c66a3eae0fc4759edd359df8cbb5683e70bae3f4deb83b14c71ab
MD5 06b60a3b0641b38f7437035c7cd9179d
BLAKE2b-256 8b4e1495a97aa599129193f64a266991dfec841b89f721ee6d3387406016d36d

See more details on using hashes here.

File details

Details for the file kitedb-0.2.15-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: kitedb-0.2.15-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 1.4 MB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.11.5

File hashes

Hashes for kitedb-0.2.15-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 41dc698e5f15055849c52fbc46b181d77cd9745096a9f5774ad350886825779c
MD5 ebab564f7286453a9b58bf7543461e3b
BLAKE2b-256 49fc7747cf6acb5fb7754afd012e5cd926924f95a697902fa2c474fac9515c26

See more details on using hashes here.

File details

Details for the file kitedb-0.2.15-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for kitedb-0.2.15-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 31b96da6598ae3d28adcd445ebac1e7e571987c9967926e20ef8b7b7cba4213a
MD5 8e2a4e3d5e88d86af29e57c9a4965590
BLAKE2b-256 2075bb015d3389ec363867cd74c56b42a37822d9f370c991072f391ce8062768

See more details on using hashes here.

File details

Details for the file kitedb-0.2.15-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for kitedb-0.2.15-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 5b89b581b5770ac10c0a83a0c1aced95d958513163dc429060f37887fab7811a
MD5 949766b27a12d7e8a3411175d5b0c267
BLAKE2b-256 0b09d1151e477f2429c1d240ea09fd101a47a8accdddc9b4c14e0a5671c48ea3

See more details on using hashes here.

File details

Details for the file kitedb-0.2.15-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for kitedb-0.2.15-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9efc318fa9a964ab98df1bf69a9262e2d6c977e78cf300ec99b3d4b51ab7be63
MD5 68ab73af52242782259ec71ac219adb5
BLAKE2b-256 612d9cec02c285ed144976eb1928fddae8ff92ce5b23838280d74c8ee0d56ec1

See more details on using hashes here.

File details

Details for the file kitedb-0.2.15-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: kitedb-0.2.15-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 1.4 MB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.11.5

File hashes

Hashes for kitedb-0.2.15-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 7ab044d7b3f701bb8f689f3d3cb8fa71f65fb2583fa4aec894f4bc414b486b86
MD5 39004a665283b978810471800eaf2a81
BLAKE2b-256 48f15303422ac6ab99fb7f351c060b0fede28b3256506a6ba1556655ef79cb32

See more details on using hashes here.

File details

Details for the file kitedb-0.2.15-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for kitedb-0.2.15-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 aa8bfa7f9fb6a4dd4e5840433ac8cd201f5d974b670eda5b914a40aba7e93458
MD5 e033f88aaf8997963b5d97819f9f93a8
BLAKE2b-256 efae2ecfcdf0d6100e4ffc8aa73ae5a1e5fd0bcacbc3863b84d2fa224fdf57d4

See more details on using hashes here.

File details

Details for the file kitedb-0.2.15-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for kitedb-0.2.15-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 0a04ff5fb12e3088b0c5ee6ff1da34711676e8e3f3bb9dafed5eb773027cf31c
MD5 b58ee182ebc3e8593a8cb4c9575a2aeb
BLAKE2b-256 0e17170df1a3a217e2e86bb110bfccdd394b733fc3781652390ba5ecfd1a2340

See more details on using hashes here.

File details

Details for the file kitedb-0.2.15-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for kitedb-0.2.15-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 43c82bf7fa98c24763747790dfd8b91acfc62a70b0295f163960342339ef32de
MD5 b7131919aa79f083f0e5b28a38ff5e18
BLAKE2b-256 35f120ff649d73dc7a3fc4450508ace16a556a08580d369cbdbfa974c85c8799

See more details on using hashes here.

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