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.13.tar.gz (1.6 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.13-cp313-cp313-win_amd64.whl (1.4 MB view details)

Uploaded CPython 3.13Windows x86-64

kitedb-0.2.13-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.13-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.13-cp313-cp313-macosx_11_0_arm64.whl (1.3 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

kitedb-0.2.13-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.13-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.13-cp312-cp312-macosx_11_0_arm64.whl (1.3 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

kitedb-0.2.13-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.13-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.13-cp311-cp311-macosx_11_0_arm64.whl (1.3 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

kitedb-0.2.13-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.13-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.13-cp310-cp310-macosx_11_0_arm64.whl (1.3 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

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

Uploaded CPython 3.9Windows x86-64

kitedb-0.2.13-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.13-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.13-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.13.tar.gz.

File metadata

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

File hashes

Hashes for kitedb-0.2.13.tar.gz
Algorithm Hash digest
SHA256 3b6d6ba347188fdfcabbbc8cf140e82f93d5b184849e954967a06a2852887e64
MD5 4ade398666dfb3624b3da2fd6fdcccbe
BLAKE2b-256 8fd2ca0da23a8624c87126259d975a49935be3f625b58f4ba84d4ec13732f186

See more details on using hashes here.

File details

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

File metadata

  • Download URL: kitedb-0.2.13-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.13-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 94042058b972e527398629600666f350a268e749d8eba262aad222989b92aad9
MD5 6ec7a3564017ed3afb6f76a0898e36c2
BLAKE2b-256 7819add743b88894d789be165ce988c7da7bca9d7b008f1900d51314a94be4c9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kitedb-0.2.13-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c955f71e101e1d90d9188454c91211dbc90d9a4c1c9a024aa40db7586f42f98c
MD5 aae91511ef8e525d7aa16a8fcbe8e92c
BLAKE2b-256 eb401dda26d59b8f6a674755f3378f63d9e81a7c456fa80c738645493e64817d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kitedb-0.2.13-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 916992d8564c3648ca9eb0c68d4a2503fa8b256585ccdc0770b81d5ab7738992
MD5 f491177007953f1e2147629a91b76680
BLAKE2b-256 eaef27e8b485c787b973d224bd2523b58334c23de5a80adfe355a71bbc6782df

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kitedb-0.2.13-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8e2999ad3918ff6ed44952bceeb92b84cfd6b5afb7e401a78653c8cdeda19dd6
MD5 9d547f2191a76e2589b479f75aa7168a
BLAKE2b-256 a4f0e7d48b97e0027644ba7f0bc680c92cd08681d0a55a63c09378e280098aa3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: kitedb-0.2.13-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.13-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 3b6acd7a890d832a60aa86c4d07d83748fb2f12316e3a59b51a17d8800f3c25b
MD5 8045dd38939bfa3bdd36ee0f892135a1
BLAKE2b-256 7b634fa4fa4fc50710b4609bc04a66a6af50372970b8d19fca783229970fde15

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kitedb-0.2.13-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 18564b87fc9dd83c2507d3adab524d9af0a32000455d6a9f319a227fd506e742
MD5 23ab741480475698f3e26bdbce327701
BLAKE2b-256 1c59d3e71a6c146484f915338bb37096ba84060515838ed570f9722bf3c77ddc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kitedb-0.2.13-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 bcd80546de5bddfa8066df3f59ddfe8bfeb950f7b66087218a68d7944e4db17e
MD5 567c753d12e9f58a7daa0e7a69ccfbd3
BLAKE2b-256 7d7bed442f52c075a0750a9575001ddd3e0461cc55092b1c6c4acf2b1e6be491

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kitedb-0.2.13-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9970c0200f9e9df5491f4ea78a3b9a30d73f08aa94e24417f2e667f18209f25d
MD5 2048ec1187a8c1733bf12748e0a0940d
BLAKE2b-256 5a83943b5d368d424a2fd9ebd4619c3fe36210750ec7d4fa69e2f2da34d197ac

See more details on using hashes here.

File details

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

File metadata

  • Download URL: kitedb-0.2.13-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.13-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 c870b67067026afa8e2c8b9778e427eb4082fbbd9abc8d05857912ace79a2ead
MD5 800022747d9637463b9e126f28c44e0f
BLAKE2b-256 7a27d9ffb4e2a9294cae62e8e93dd846d9b1c27662add6eb1309b621d058bde1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kitedb-0.2.13-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5e9fddddfbfd7a954c9b2fc19b3e676269ea82545ca0e0ea1b4121299e589eb9
MD5 803449a0f999e30c2f7ab09891cdc12c
BLAKE2b-256 370720271b6776c6caf2ff84ca9f137dd8d04e49a0356f0a3bce2f197d7c599e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kitedb-0.2.13-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 8ce2bcdcd5de8bf8d469e01a49f76e1a4e55a4d8085eeb45dfa6e72aa59b576c
MD5 f5da7552925e989f0c61cd4fb85bd738
BLAKE2b-256 eaadee85195996bda01e488a3cea9df68ae329755d9c17f96849aa9b07a65e42

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kitedb-0.2.13-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2eec7e995e75a02e3ce32a00db2f7f01ef2d40a8365963285fc5a01babe83618
MD5 ba92b01616c9d5cf1f83fa17fb63b62a
BLAKE2b-256 03364179c52efb2d98bb045cd781b1e4ccb483fa3750642992e53396bb8d087a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: kitedb-0.2.13-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.13-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 c6886da2ed1b5bf80c0fd93d36999dcedc7f47cde8816189c995e47581072ffd
MD5 003dee1b97cd1b719ecbc3b41fb047fb
BLAKE2b-256 0307b672c39ebd5757bd4909f533068fe6b450a9398db9941af03e9492d5c790

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kitedb-0.2.13-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b668d25255755dfd67fb27118fcca6c3989014498f8e036edd6e49070bba6c88
MD5 76263e4ba12dd5c5ebbb0a316aac153f
BLAKE2b-256 372e1b2856807bbf0f08c8b093d8ba7983e7f121d268ebf4172f610f44922755

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kitedb-0.2.13-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 25ea9444c0bac9455d2ab7f314bc47b204ad234573e7e50fcb361ac08996904b
MD5 105590bd0c781362d1fb59fe8a9eae2c
BLAKE2b-256 4eb67a33ba29f376b9f1e07595d0adfc9c97472edc441d330eabb70702938337

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kitedb-0.2.13-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 35bd708c3edea8e183a7acc331a8a8bee33787a70a76b4039a3dea74637f6484
MD5 59683dd126065ea9bf9321b6d0143e2b
BLAKE2b-256 0830370cda2e19feb096bd4d36847a3aff7bee6aa741fe7597c7ac43e37acd58

See more details on using hashes here.

File details

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

File metadata

  • Download URL: kitedb-0.2.13-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.13-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 5ad7e2079dcbf20ed893f6086c87f88d3ffbe9f4aa53bfc7b695be4ce96a56d4
MD5 8acfa663428385cdecf961c935c882aa
BLAKE2b-256 c853882f5796d36225bb0dfafe4c28f4ff125c40257020d974fb574323d1ea1e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kitedb-0.2.13-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 866e22ceb58a50c422f8e1524fca0da9b174560d8d66f7a8009709875b825fe6
MD5 907ba344aacc8c5289385cd2cf82b67f
BLAKE2b-256 dadbcb21c2c7c8da15cc10bb3f25c7cf02bd714547b381982f8c9b4107403e4a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kitedb-0.2.13-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 d7a6b3deada396d8691b0372fb4b39adcc4a732ecf9106e01b39e4ccbd749961
MD5 fc940e01a2f9ed142f9ac84e80d8abaf
BLAKE2b-256 8fcb977cece166876700b4a351b43fd09cc075117947bd92b3a41406d920ca4c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kitedb-0.2.13-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 11bedbfa62482a7d9807072d439980ef01e4afb125aff87e72865b57841dd05d
MD5 f0d9b8e64f2e4bab94b3fee0a069b41f
BLAKE2b-256 a53424c502f58dbe6080d0f3060d31366a87c53766134ff73df05312e67b52dc

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