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())

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.7.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.7-cp313-cp313-win_amd64.whl (1.5 MB view details)

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13macOS 11.0+ ARM64

kitedb-0.2.7-cp312-cp312-win_amd64.whl (1.5 MB view details)

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

kitedb-0.2.7-cp311-cp311-win_amd64.whl (1.5 MB view details)

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11macOS 11.0+ ARM64

kitedb-0.2.7-cp310-cp310-win_amd64.whl (1.5 MB view details)

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.10macOS 11.0+ ARM64

kitedb-0.2.7-cp39-cp39-win_amd64.whl (1.5 MB view details)

Uploaded CPython 3.9Windows x86-64

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

File metadata

  • Download URL: kitedb-0.2.7.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.7.tar.gz
Algorithm Hash digest
SHA256 6ecd425daccee7dd55df1019847129f278008142534389393e23703e480c77b7
MD5 ea76f2286bd16f81d61238e50803c7e0
BLAKE2b-256 fbafdd2ea465d86962edb7cb3939b3b60d55ca0776722b2d2936bfc747767405

See more details on using hashes here.

File details

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

File metadata

  • Download URL: kitedb-0.2.7-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 1.5 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.7-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 1fa4f715bd1cec74e7b8e9145f339e8bf4d631827e562db1e8e214f97b78479b
MD5 1442a819dbb7fd67421e023bef6a3e61
BLAKE2b-256 1df920f77fbcbf18dc49e014979a52ca6bb6db91ea58179096abba9438ac37a4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kitedb-0.2.7-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2b7b57470195e3f1f88a4c569f8fcfa4b6cb952ded3cbafe2e427033b33c25bd
MD5 cb50acde804c70d2e1934d4bc35026bc
BLAKE2b-256 302a8fcb2e59e42a234a15ce1f242891c68bd5c327bbcc149d7d77edbcdf4eca

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kitedb-0.2.7-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 71d9a6726d598c1adaf43a2fdedf9d4844c0a85dd44b330d682228d891d4c71b
MD5 96793738db0d028dae630c2200ae184a
BLAKE2b-256 3cbb477f15c976d752f2ef21dd4fe1475badebf014f5c61074ed1bbf738e1a66

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kitedb-0.2.7-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6dae62292ef0104f8098e94a26cdf2a68d6ec5c294dd0b676d5e8a2daefeb26b
MD5 7e9c19efb3374c1a292d7a24d707d6b6
BLAKE2b-256 a944b875113dfbec407303f3d0c39f71c3d2356d2c6b95e6966d24330020f988

See more details on using hashes here.

File details

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

File metadata

  • Download URL: kitedb-0.2.7-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 1.5 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.7-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 4e31a9782a4cac71e754ff688c077928019534a64af7934a98037269f9eec157
MD5 de7499f825d5ca18b0aa5d9123807812
BLAKE2b-256 b338f19153701b4c70bce8c2dacb189012b50d9c6035bc40f591191b20a67f9b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kitedb-0.2.7-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 552f7c77e8db0a1dcd92b802a683de35ad0cbecd046117a73b87187cb5a78030
MD5 7b4d5eda5742accd5ac7073489382fed
BLAKE2b-256 88c74b407ca924f82c560df64c41563ea8c64d3d9555e51730fa6f70f63552ae

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kitedb-0.2.7-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 3efda1eefddc5eeaa44203e644ed107226f2b72e3f9decf09a6b61c9090d2490
MD5 c0c849a80549fd371a04063eceb7b4c9
BLAKE2b-256 beeeea282021e290c08e27a88d46d5f9a46d9b903679d51b4e5695378c5ccc35

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kitedb-0.2.7-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 fefad94159c16dec80b8bd3f828fe796cb7dbf600eacc1de3023dab67d27f772
MD5 dbfe9864d3d0a94eae72155a1c580b1b
BLAKE2b-256 463978b5089f46b31a8317865dc980ea2cac1a232bf04f692e65b873fe394535

See more details on using hashes here.

File details

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

File metadata

  • Download URL: kitedb-0.2.7-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 1.5 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.7-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 067d2117ee6c6284a5f689949b11e9331478a7a69466968e5ccd686663a84a2c
MD5 aba5ad94bb382bd988cb7df032452333
BLAKE2b-256 30b15d794e38f16b2ebe5c5e7df5556d518303251a3dc5a6cff4799740c2f129

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kitedb-0.2.7-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e40f50f2f7fab59900747db3d8857449e25d11fd4ac7b15b82cb720edaec7cc0
MD5 c8a760c1a4c9db8db40b0fb6bf0f4af8
BLAKE2b-256 e04c81f50bf0b4b8b01503a67025d1ea96a461d24354ed83266ef33f75613197

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kitedb-0.2.7-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 e24fe1207b00fdd6d08241f410a8ecd92ea205e9a7524b312a6dd0ca3f74f075
MD5 ecd109023f9db9658431dece0fcb4eeb
BLAKE2b-256 fa13b3d72e186993186744e5477e0c4ab8aa137c915d4a7071e5f43c9fee9c06

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kitedb-0.2.7-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 804c8b6be1c1efa9f6f176d810443063f6a79fc4d2476599f575ed12bc8660f7
MD5 ee6cdb91e0343786221909be5179776c
BLAKE2b-256 2b9a83544eaa94ae799cc73750eaa4c80e33c06d64aacd717a7a861bb00b44cd

See more details on using hashes here.

File details

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

File metadata

  • Download URL: kitedb-0.2.7-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 1.5 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.7-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 cafd931e212fe19eae70732d011277434f72799d0cbd058ba8db107c162b584d
MD5 209edec943bd8612311a559d4e779359
BLAKE2b-256 12939e5087fb5abb5211619be3a58c6668d3b9fd333ef971d5aa4ec2569aa852

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kitedb-0.2.7-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3a60f9af1ca4588101dcb320d40dc183bfd98de59951c5beb7ee726c40dd93ea
MD5 0f4456cc8a976cbd02b42a83ccd5cf77
BLAKE2b-256 60f7156dc4b32ead4e5f628a5380f5009393579400c968bfe973ea498022e65d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kitedb-0.2.7-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 80c08676b3073727260520a8e88163b2fcd77bd94bdcf33f896b49903cd8da69
MD5 ac934bb415f43c245e13b71d5d03ff49
BLAKE2b-256 d9685ff177b7b7f5b4b5c6166d49f9b68688cfe0b6590f84cf36705a4110c031

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kitedb-0.2.7-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 018bb77bb5917ddff7e63be51b720f03613ba9935d36d8d3092ca5b4be16763a
MD5 f09ac2c527f1deea14c9fb42d4feda49
BLAKE2b-256 4aea557a779d745468d08fa7dd825f2893e1f5d0d7eb9a508a008216978e54c8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: kitedb-0.2.7-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 1.5 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.7-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 a446c51fd7e9252d355033c62331f7b32a646d2937a5461980ee01afb73c1cb3
MD5 60af9227f45ead0a3ef4fd848975b356
BLAKE2b-256 3a2f793ee907a9a72a681514bfd723ad5e05894e7d0352c3b4ab297ccfdc5af7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kitedb-0.2.7-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3d87def37cb210319803e077c54c8a91131bc2bce9d57c3b0401e5309f751924
MD5 4658ebdf7fa3f15a8e46bea7ce42c06d
BLAKE2b-256 fccdfa4df8da772f8bb05950bffd8b989cd710807e78994d10b12ed99014dcdb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kitedb-0.2.7-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 ba56223613fb962fa3c75a53517d110e5fdb1a15f069cb90a185c5e60b994bb6
MD5 32bcec56e568d4c00e52bb77dc19b4d2
BLAKE2b-256 90d2c3141b0b08e4e3dd00bf1aa66789a61347470b55043e83df1db44fb18e61

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kitedb-0.2.7-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 24211ecd7c3e493458197a34121244b867ae42220ae5922e393a7cc907190578
MD5 6ae3d35dbb5d63ad25f92ebf2348a8a8
BLAKE2b-256 bb07df55d0958696134a443adb94a8cf290e6261636608ca02f18337e6dce887

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