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 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://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.6.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.6-cp313-cp313-win_amd64.whl (1.4 MB view details)

Uploaded CPython 3.13Windows x86-64

kitedb-0.2.6-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.6-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.6-cp313-cp313-macosx_11_0_arm64.whl (1.4 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

kitedb-0.2.6-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.6-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.6-cp312-cp312-macosx_11_0_arm64.whl (1.4 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

kitedb-0.2.6-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.6-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.6-cp311-cp311-macosx_11_0_arm64.whl (1.4 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

kitedb-0.2.6-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.6-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.6-cp310-cp310-macosx_11_0_arm64.whl (1.4 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

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

Uploaded CPython 3.9Windows x86-64

kitedb-0.2.6-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.6-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.6-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.6.tar.gz.

File metadata

  • Download URL: kitedb-0.2.6.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.6.tar.gz
Algorithm Hash digest
SHA256 1ac2295f44a72f729095237c66c9219338d9146a881daa0ef22f1451d420fb3c
MD5 2123f57e53904eb84cd1f30f1a17a755
BLAKE2b-256 c9d559c3b3aa7e4aee8feee692cb2c4d3ef2989d7aa55cb0d93d9c86bceaf810

See more details on using hashes here.

File details

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

File metadata

  • Download URL: kitedb-0.2.6-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.6-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 fed958f875c2898d3f9cbb1ef780384d810795c63364d16808f39b087bafc1fd
MD5 49f15a4f8162b84f2128900361969242
BLAKE2b-256 768cb680ed61637881a6b0d4d51c7a2bc22bf65af64b0f3234041b96147e2f6f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kitedb-0.2.6-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c790a46a017ee61279f907e7c1b99fe894e89433969e913e7ab50ebc68be8d5c
MD5 45bc7bb1ae08174fc4f6779f1d0587ea
BLAKE2b-256 f6ecee0e1ff17482270908aa9c696ca3481684108be3cc973e9501e459cee538

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kitedb-0.2.6-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 867fcaadc5a2cc8bc5de4cfa1329dab187bf9db11dd82b770e2dc536dbc0e2eb
MD5 79d5db0c66ae825eec11f61efb5727fc
BLAKE2b-256 7467221dcb7b072d0045c3d6864f96656812ad63157dbb045d81738d6d49d22f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kitedb-0.2.6-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a08173980d015893247224fc977828d6d460a2b02aae4c36cce824bafc945bd0
MD5 6b7e3afd5352f20570ae08602bc1cdcf
BLAKE2b-256 fa1e3a6ef3eaf3d99cf3f21622ff042f4a0efdc57327bcc98282e530394a234e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: kitedb-0.2.6-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.6-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 840214ad1afdc388403a9dbfa86cd23bfe949d446ad508f1d14f85e82b14a397
MD5 94b731127670817c2e1720cd5261097f
BLAKE2b-256 eadf312a389e7191ed665d305acea896ecd501ed4d03c7134d0c9a880751c4b0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kitedb-0.2.6-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 68e382c00bfb3ab109a56da6dd8b2c6e30301600ff8c45dcbcb3ddfcd0db8812
MD5 b09fbf85d2d5306909a539e19a219d33
BLAKE2b-256 506815e810b726b82e73c9dc25378e41903a2fb154cf3b5a28e13abd2555b2b0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kitedb-0.2.6-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 c5595ae518a5c3a0ed2263cc7781afa03945e5571b2d782cdc8bf7e28837ea6f
MD5 7b92ece0a2c95fc91f0216c90f258088
BLAKE2b-256 44d112f968796e1191ebf6c20899be7480456e83c84a6faae4597454bd79e8a8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kitedb-0.2.6-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 fd939a551ca7263ef165de69941f3c0191da67c4a9d15d388ffe592a239d04d3
MD5 8406d6f10a90cecaccb0e2fa65642504
BLAKE2b-256 28dc77e9cccc421c962ecbb57c349d84eb6fc6b5024789ed76be068715368499

See more details on using hashes here.

File details

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

File metadata

  • Download URL: kitedb-0.2.6-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.6-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 0815e7c99a10e0c6ca27fc3d790101292c36e823eb3e5814ba59a03078f39ef0
MD5 8b4497bf50e03b3f0ed54792251876b8
BLAKE2b-256 6e3b4b265378b9abf34282aa9591f67a81da516ccda5f099c494c95112a6be6b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kitedb-0.2.6-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 830e8c54614c07a65804bc1c1de8963c4ffa9fcf242d3114e77082c232444f23
MD5 9a638e6e649b4537dc614bef0fa8c563
BLAKE2b-256 4b0eb61cf5527203176f5407642a35d3816d1729ae82408e9efa0b7789b78e5f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kitedb-0.2.6-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 f197fe71cad9040ab3d84accbba1294d8e79deb498fa1946e0228d531b0ab857
MD5 819729cc12a63c170f9ab8bcf8a47094
BLAKE2b-256 bcb046bcfc15154c6ce5e15848355518f130a9b54d66d83b31a18d1a6a1bf987

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kitedb-0.2.6-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e0f2c3353386fb72d7e30b090049e1280efd932138c65be4c4b48b9e369adfbf
MD5 facf1cbce8219c5722fff65f440ac4d8
BLAKE2b-256 ba781eb46159ce6b94be647782950f9d631db8ab5ce896d0cd3a44c45ed4562b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: kitedb-0.2.6-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.6-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 5de56dd6654b9b4bc6ccb88dfc14f9d100d14f1717825a4e45a27db9c3e518af
MD5 3710cbb0e24c33ed328dafc76d695f2a
BLAKE2b-256 0490b8e98af642ccebd1ea36540f6d5ae345d5147cd344bd5b17a3b8bbbad754

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kitedb-0.2.6-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 183af9f8e88a4422d61f049bfad50706a20ca62d43353e66ea25aeb1f32e58c2
MD5 9b7fe687afe6eb5494ac3dc68511b0ff
BLAKE2b-256 87a76504cf9930b50f21b43ac7b85767ced4c3c2fbb2e865395abe545a0fe5c0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kitedb-0.2.6-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 8c8ce0a6e9fcff24f5c2688acb18d556a412050050e9a97ea9571627721c94fe
MD5 70fee08b4b37b902fa0e560e839d10c1
BLAKE2b-256 d1803b63d29620366f226e65ae4700d0c199cee4e39be7a2fa6c89f9448852d2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kitedb-0.2.6-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e2a242fdc22e1f41b925dc931c9f0789b080b14d47c59b1c8054df7030536595
MD5 452198f379e67f8c73b4f0855fbd6049
BLAKE2b-256 f705b7444c223a13ba97ce27f4b5d4562fbe14a12a43b6cfdaaeb4c78db378c3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: kitedb-0.2.6-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.6-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 f4ed14cda9feab511a85d9814a839bf1dc7b507fb727ede0d20a6127b6afd326
MD5 83e4afd9d6ce8d2e7d5797025ae434d6
BLAKE2b-256 73673c541676f4d43dcf26400c1485b471e2a60130bf7f0f7b018d6dda0a55a5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kitedb-0.2.6-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a59ddf1d815ba2942bbe727cf2b6502ccd435fcc5db1baf8bc29aa9ff4356619
MD5 d9ee276f177d9832c6f9663e44552ed9
BLAKE2b-256 303d6e74c11efc4683ba1566d055eaa7e626a7bd16e359841dbe4d03e1415114

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kitedb-0.2.6-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 059ac9c5f013422cb67967f9ad5e94aa303a3e433383642e037367f3108b88c8
MD5 97869d9e6aa83f6c980c02fceeec1a40
BLAKE2b-256 a512bafcd020d8ffe04be197d892163fd7701832385e5b1f0092e607bdcfd573

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kitedb-0.2.6-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b68b430146573e49065253dafe34fd127f0efdceb6273536aade47907747330d
MD5 e3ba2ab643e75fea7965173315172cd2
BLAKE2b-256 77f4c0fec6064375c1040b74e445ab3d672edb9b7660f5f106e92e42eb89f269

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