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
cd ray-rs
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 ray, 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 ray("./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())

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://ray-kwaf.vercel.app/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.5.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.5-cp313-cp313-win_amd64.whl (1.4 MB view details)

Uploaded CPython 3.13Windows x86-64

kitedb-0.2.5-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

kitedb-0.2.5-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.5 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ ARM64

kitedb-0.2.5-cp313-cp313-macosx_11_0_arm64.whl (1.4 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

kitedb-0.2.5-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

kitedb-0.2.5-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.5 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64

kitedb-0.2.5-cp312-cp312-macosx_11_0_arm64.whl (1.4 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

kitedb-0.2.5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

kitedb-0.2.5-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.5 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ ARM64

kitedb-0.2.5-cp311-cp311-macosx_11_0_arm64.whl (1.4 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

kitedb-0.2.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

kitedb-0.2.5-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.5 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ ARM64

kitedb-0.2.5-cp310-cp310-macosx_11_0_arm64.whl (1.4 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

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

Uploaded CPython 3.9Windows x86-64

kitedb-0.2.5-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

kitedb-0.2.5-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.5 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ ARM64

kitedb-0.2.5-cp39-cp39-macosx_11_0_arm64.whl (1.4 MB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: kitedb-0.2.5.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.5.tar.gz
Algorithm Hash digest
SHA256 f1b90fde6987c9e387594c021bbac017ec0f169979f764084de8e4fa9c08867b
MD5 0236756fe4da2bbb5c59c3e4b465920e
BLAKE2b-256 74fcadb2c3d923da48ee8272e4e2358bfd5bf34834a17f32afe2a141a7b92104

See more details on using hashes here.

File details

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

File metadata

  • Download URL: kitedb-0.2.5-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.5-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 f5d4a577bf98539fb0afb66e395f9f8c91aae15b28dda86ae2499b8605e50d15
MD5 db5c908071c703b7d3bdeb232604277e
BLAKE2b-256 e05e0e96ef31141760ca564347cc2eb16393b78dadedf02e421c16cd257ad261

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kitedb-0.2.5-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 455d04a924b3f0a1c23397d06ea480fe9d09461b91e529de5678730042e1db6d
MD5 6c23b2f4e6b68674f274a6cfebd3d969
BLAKE2b-256 0221de1c411cd10f7355a53010d2eb08a5de4c174ba51dc6a0a9e470764931ee

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kitedb-0.2.5-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 0eaef29cee7ca5275055e1f440b222eff36a7a83b1d17c23911a19999eff2ad6
MD5 372fdc487dfb535b0f1edc075ec39762
BLAKE2b-256 b618d672199f086071fd6c5b2789dc4b7c6224043dd69290b608c17567945e51

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kitedb-0.2.5-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a9f8c42ab4d83deed577d6b576dc093e8e6d77e44994e9c85b5c39d2ff8ab8ec
MD5 6fb4278fe247921827ddd441e9b43b44
BLAKE2b-256 80d97b5272ee2282e7acabbda9503035fac498d851dd43e41c4893b83a1eed0e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: kitedb-0.2.5-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.5-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 a612a8913d51f23d76c06f2bbf6f170fd15c70926e7515b1ea1e75fa5427d56d
MD5 c26994799f5931ef5b737064c4f28243
BLAKE2b-256 ec8769586e146c05a9f1e6be2fc089dc7579d8df0a30e17cd690243f1dffc846

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kitedb-0.2.5-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 6f7fac2b33eaad5a49705ef75e352d66294e6ed5f6cb8b960cce5c2be3e92c14
MD5 8420b0160f6d729d05afb285d8112dcb
BLAKE2b-256 a4f25f366530b8dbbb98d48d8b0673e0575071f5e1647110a7e4bcd7e928b5a3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kitedb-0.2.5-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 6cf0f103457149291065db8039ca09b75fe76e23e0828bc69a8534d3e4a5b577
MD5 85b7258715dd9a87e0c6834e5dc819c8
BLAKE2b-256 e59f122e50e90139307026850b3a7b028de2312943f5598cef7975800377a2f9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kitedb-0.2.5-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 50b9446d8f717edeabf5fb9a89479a20bc9c7093480774a09fffbf2e35123a34
MD5 7bcefb9b5a0f2d2513511127404ad1cd
BLAKE2b-256 d169dc7b6d37ae8c024e766656acbd67c7b8e4e996d0910da788b75f5da5783a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: kitedb-0.2.5-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.5-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 8d3493ea8135432154ecda8411de9a84fb95abbfe9e8a8c9ee92addb9bfbe7fe
MD5 db6e29e492f3f438b7e290010aff934a
BLAKE2b-256 8a651b408fc052a79d3df0ad7ae3cbe8f0fdb4a1d8a089e3fae7ec7de9f87570

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kitedb-0.2.5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 451ec7aa49ef94bfba22e92d13cdd5400d43843932cca60122a03005ce13d1ee
MD5 e4296f47b5fe7222f01c919f662ebc6a
BLAKE2b-256 1787b54e5b7e9c13cf2fda533431a0e8ec88b7daf7c3a472c2296a08fb1e5f63

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kitedb-0.2.5-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 c0dbad7d0cee5c4eddadb831fca8b19c4cf56c95e9d3295e3751d53d6e7120af
MD5 f6d53c5e92f3b601768bb3610ec1e1ea
BLAKE2b-256 7fb03c93683c7fc3fe113839d5e078a0dba18e30ebb033792eebe57f9d7db2f1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kitedb-0.2.5-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 fc31a4a06a5f8ebc0b0c7d018898e7c89d5077bce5f4b0519a507ba77b699b6f
MD5 3c3eaf78f375e712e634f5a6f4030b94
BLAKE2b-256 182d1390d6555fff5933b867e8018d9c4174a3143c06d8246c7acd64b122f640

See more details on using hashes here.

File details

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

File metadata

  • Download URL: kitedb-0.2.5-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.5-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 ed7108f46d53f5f4fb354f7251eafdd4d1d1a0a6b4b03a83ed1f824b24d6112d
MD5 c5b46c5d25e127b21a879c48e76b5191
BLAKE2b-256 8659083c7dcaceb9dfe3a567d877649652cf56f87e144266b4c131a8dda99772

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kitedb-0.2.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2517cb442683424822108c544fc8b50e46c2d4cd7e2c9fb9978aedaac8879dca
MD5 90d6ea1e5d318efa0001031f0b81fe4d
BLAKE2b-256 855c091d290c5a3b15e41aa3c81bac96b54bb21d802b1aba2271841fea17bc46

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kitedb-0.2.5-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 2de007aaae97c46e495f8d8bd86dc7a731007057378e05ee965ad2421ae9e097
MD5 5f5012676d3b22753603c5c2ffcffc54
BLAKE2b-256 43f245cc1e50230f674cd1b67ab00a9bc607aa9c41040cb1c9dd84333ff4b186

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kitedb-0.2.5-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7c23ef18e96a43fc7bd82e1dfb6da59030705dc50fd2eff6b96807b78bcbde1b
MD5 c8a8a00bcfe41350112c56923842093e
BLAKE2b-256 f44bf4311a196b0df1ca042a8d4e6f6ed89e2f420d5c1b8433ea86e535bf81f5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: kitedb-0.2.5-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.5-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 327228a1b4a8ef995680b3491ec87e27136e41c593f02b601f140d59bfddfd5a
MD5 fec7c8a2e316b4852b8f37fe65380336
BLAKE2b-256 ccdff3b3b7964a9743870730c0931a8e8df710517e27e2a3f5e3e8b7b0ebe2e5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kitedb-0.2.5-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a93b5e89e2e3e4c19139527723a17417bd3d98995c7d1bbbdbb256b5c84c7f0b
MD5 4f5cb134b2eba341fdd8040cb76dee6b
BLAKE2b-256 6839ad54d4c0f37164221f0c83379513934d50295868ecdfef11f8f3f71ab9bd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kitedb-0.2.5-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 aa0437ac4164e3664226ec91d5d4a0cc64136fc20e1a074c8429f10dd9f0f55d
MD5 bb182b7bf4b3dbacd774fb14acc45567
BLAKE2b-256 d4cc633fffbd2f985fdc7c1e59319dff04f6a0b31863ae0102d44d8f17f2c6cf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kitedb-0.2.5-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0be088ca500e4f51546e8e33fce07901ce3e43f3356e339a7f0f99a89012ec81
MD5 bad15db2cb086fcbd1266955d5f9f7c3
BLAKE2b-256 b71144a34ac10498ae8105ddf834eb516ccb004159ffc566a21a4bbf5bff0685

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