Skip to main content

SQLite-backed KV store (Rust+PyO3) with vector search, auto-packing, and efficient array storage

Project description

KohakuVault

Ask DeepWiki

One-file SQLite datastore with:

  • KVault key-value storage inspired by BoringDB (streaming blobs + auto-pack for dict/list/numpy)
  • TextVault full-text search with FTS5 BM25 ranking (ideal for RAG pipelines)
  • ColumnVault columnar layout inspired by Stanchion (typed chunks: i64, msgpack, vec:*) built on SQLite BLOB ranges
  • write-back caches plus standalone CSB+Tree / SkipList containers for ordered/temporal metadata
  • VectorKVault (sqlite-vec) for k-NN search living in the same .db
from kohakuvault import KVault, TextVault, ColumnVault, VectorKVault, CSBTree
import numpy as np

DB = "test.db"

# Store media + metadata in one file
kv = KVault(DB, table="media")
kv["video:42"] = b"abcdefg" # raw bytes stay raw
kv["video:42:meta"] = {"fps": 60, "tags": ["tutorial", "gpu"]}  # auto MessagePack

# Full-text search with BM25 ranking (great for RAG)
tv = TextVault(DB, table="docs")
tv.insert("Machine learning is a subset of AI", {"category": "tech"})
for doc_id, score, meta in tv.search("machine learning", k=5):
    print(f"Doc {doc_id}: score={score:.4f}")

# Incremental columnar logging (no file rewrites)
cols = ColumnVault(kv) # or ColumnVault(DB)
ids = cols.ensure("ids", "i64")
latency = cols.ensure("latency_ms", "f64")
embeddings = cols.ensure("embeddings", "vec:f32:384")
with cols.cache(cap_bytes=8 << 20):
    ids.append(len(ids))
    latency.append(12.3)
    embeddings.append(np.random.randn(384).astype(np.float32))

# Ordered metadata via embedded CSBTree
index = CSBTree()
index.insert(latency[-1], ids[-1])  # log-latency -> run-id

# Vector similarity search (sqlite-vec inside the same DB)
search = VectorKVault(DB, table="runs", dimensions=384, metric="cosine")
for idx, emb in enumerate(embeddings[:10]):
    search.insert(emb, str(idx).encode())
for rank, (rid, distance, run_id) in enumerate(search.search(embeddings[-1], k=3), 1):
    print(rank, distance, run_id.decode())

Why this exists

  • Single-file SWMR – SQLite WAL lets one writer and many readers share a file. Parquet can’t append, DuckDB locks the DB, Lance spawns version files.
  • Columnar layout, not SQL tablesColumnVault stores chunks in col_chunks/_idx, Stanchion-style, so incremental appends don’t rewrite tables.
  • Auto-packed KV everywhereKVault (BoringDB-inspired) automatically serializes dict/list/numpy values and keeps raw bytes untouched; every key-value interaction goes through this pipeline.
  • Write caches – Vault- and column-level caches batch inserts automatically.
  • Standalone CSB+Tree / SkipList – Specialized containers for ordered metadata or range queries without leaving the process.
  • Vector keys/searchvec:* dtypes store tensors, and VectorKVault (sqlite-vec) runs k-NN search inside the same DB.

If your workflow looks like “keep logging forever, but don’t spawn thousands of files”, KohakuVault is the tool.

Installation

pip install kohakuvault

For development (build the PyO3 extension, run tests):

pip install -e .[dev]

# everytime you change the rust code, you should run this command
maturin develop

Use cases / references

  • Media vaults – Random-access blobs + metadata (tests/test_kv_headers.py, examples/basic_usage.py).
  • RAG pipelines – Full-text BM25 search + vector similarity in the same DB (tests/test_text_vault.py).
  • Incremental ML logging – Fixed/var columns, vector dtypes, caches (tests/test_columnar.py, examples/columnar_demo.py).
  • Vector-heavy retrievalVectorKVault, CSBTree/SkipList, auto-packed metadata (tests/test_vector_kvault.py, examples/vector_search_numpy.py, examples/all_usage.py).

Performance notes

Benchmarks on an M1 Max (WAL on, cache enabled):

  • KVault streaming + cache: 24K writes/s, 63K reads/s (examples/benchmark.py).
  • ColumnVault extend (i64): 12.5M ops/s; slicing 100 elements hits 2.3M slices/s.
  • DataPacker vector unpack: 35× faster than Python loops for 768-dim tensors.

Documentation

Development workflow

pip install -e .[dev]
maturin develop

Formatting/linting/testing before PR:

black .
cargo fmt
cargo clippy
maturin develop --release
pytest
  • PyO3 module: src/kvault-rust (use maturin develop if you prefer).
  • Format Python with black.
  • Keep docs updated and linked via docs/README.md.

License

Apache 2.0. See LICENSE.

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

kohakuvault-0.8.1.tar.gz (218.2 kB view details)

Uploaded Source

Built Distributions

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

kohakuvault-0.8.1-cp314-cp314-win_amd64.whl (3.3 MB view details)

Uploaded CPython 3.14Windows x86-64

kohakuvault-0.8.1-cp314-cp314-manylinux_2_34_x86_64.whl (4.0 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.34+ x86-64

kohakuvault-0.8.1-cp314-cp314-macosx_11_0_arm64.whl (3.5 MB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

kohakuvault-0.8.1-cp313-cp313-win_amd64.whl (3.3 MB view details)

Uploaded CPython 3.13Windows x86-64

kohakuvault-0.8.1-cp313-cp313-manylinux_2_34_x86_64.whl (4.0 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.34+ x86-64

kohakuvault-0.8.1-cp313-cp313-macosx_11_0_arm64.whl (3.5 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

kohakuvault-0.8.1-cp312-cp312-win_amd64.whl (3.3 MB view details)

Uploaded CPython 3.12Windows x86-64

kohakuvault-0.8.1-cp312-cp312-manylinux_2_34_x86_64.whl (4.0 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.34+ x86-64

kohakuvault-0.8.1-cp312-cp312-macosx_11_0_arm64.whl (3.5 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

kohakuvault-0.8.1-cp311-cp311-win_amd64.whl (3.3 MB view details)

Uploaded CPython 3.11Windows x86-64

kohakuvault-0.8.1-cp311-cp311-manylinux_2_34_x86_64.whl (4.0 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.34+ x86-64

kohakuvault-0.8.1-cp311-cp311-macosx_11_0_arm64.whl (3.5 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

kohakuvault-0.8.1-cp310-cp310-win_amd64.whl (3.3 MB view details)

Uploaded CPython 3.10Windows x86-64

kohakuvault-0.8.1-cp310-cp310-manylinux_2_34_x86_64.whl (4.0 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.34+ x86-64

kohakuvault-0.8.1-cp310-cp310-macosx_11_0_arm64.whl (3.5 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

File details

Details for the file kohakuvault-0.8.1.tar.gz.

File metadata

  • Download URL: kohakuvault-0.8.1.tar.gz
  • Upload date:
  • Size: 218.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for kohakuvault-0.8.1.tar.gz
Algorithm Hash digest
SHA256 ecc39b60a1d4cbe6aa73dbe1a23927b610062724e04bae83a3b274a91dacd56e
MD5 18c3fbd7d381f167d8aa1e53c372a84b
BLAKE2b-256 ebe2b51df05cae864c2f920d7c98a5d9ceec13518b33f748e0266eeaaee9f3ee

See more details on using hashes here.

Provenance

The following attestation bundles were made for kohakuvault-0.8.1.tar.gz:

Publisher: release.yml on KohakuBlueleaf/KohakuVault

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file kohakuvault-0.8.1-cp314-cp314-win_amd64.whl.

File metadata

File hashes

Hashes for kohakuvault-0.8.1-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 49ebfa15fbb8a1b2a42e4ca7c213ace04b283e280555b0cb1530f1caed548dbf
MD5 4ae3291a4ffafd2ad668185248aa1efc
BLAKE2b-256 69d824164e733aac61b5fa5b72d4434cb962803d5ead5f5a4ffb37dd44adc77e

See more details on using hashes here.

Provenance

The following attestation bundles were made for kohakuvault-0.8.1-cp314-cp314-win_amd64.whl:

Publisher: release.yml on KohakuBlueleaf/KohakuVault

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file kohakuvault-0.8.1-cp314-cp314-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for kohakuvault-0.8.1-cp314-cp314-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 f9b253ce5adc223ffd88d24c2788338d0e8d0d75641fb815d870bc27bbf2b166
MD5 16e0cc7aed4ed5d4581c1022cfc2e521
BLAKE2b-256 322bc1adf3c788f4a9b633b372bb5f5868c3fb22e635321d72a7032ab82619d4

See more details on using hashes here.

Provenance

The following attestation bundles were made for kohakuvault-0.8.1-cp314-cp314-manylinux_2_34_x86_64.whl:

Publisher: release.yml on KohakuBlueleaf/KohakuVault

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file kohakuvault-0.8.1-cp314-cp314-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for kohakuvault-0.8.1-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 75ff5a9e35acc306dc0a69fd4aa26a43069f23dbbb3f30d1fb613cb376578ed3
MD5 26731c13007737e7d44408daa735d532
BLAKE2b-256 bb3b38c72bebb76b6bdac7525eba8dabb2458ee939d837a1ea01097b294312ae

See more details on using hashes here.

Provenance

The following attestation bundles were made for kohakuvault-0.8.1-cp314-cp314-macosx_11_0_arm64.whl:

Publisher: release.yml on KohakuBlueleaf/KohakuVault

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file kohakuvault-0.8.1-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for kohakuvault-0.8.1-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 c956f4ad6cd3c4c61e1e14c25f6aafcfdfde3381341cef9713343577ceddf319
MD5 47caa16eac3cf9b4d78c3b2b7609737e
BLAKE2b-256 3843ab7778f336794f17f87417f53af2904d0f5e84de3b0e300b083abd3fa354

See more details on using hashes here.

Provenance

The following attestation bundles were made for kohakuvault-0.8.1-cp313-cp313-win_amd64.whl:

Publisher: release.yml on KohakuBlueleaf/KohakuVault

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file kohakuvault-0.8.1-cp313-cp313-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for kohakuvault-0.8.1-cp313-cp313-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 7ad61764325b94c61166b239619ac0e214f2af9a24c985620ed6b6a7a1148918
MD5 02cda29da1c2d9bdb2b0fd59a38f7187
BLAKE2b-256 529b173555eb17b5d4a459400bd14b7763a3e2aa69d7c5fa863493f5294db2fa

See more details on using hashes here.

Provenance

The following attestation bundles were made for kohakuvault-0.8.1-cp313-cp313-manylinux_2_34_x86_64.whl:

Publisher: release.yml on KohakuBlueleaf/KohakuVault

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file kohakuvault-0.8.1-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for kohakuvault-0.8.1-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a184d4f01c209f42891800b9d65e7753b3cfd267aed0b23e8574f119f7805225
MD5 1fc14d830ad3c2e44073e3bd1c9ae6b5
BLAKE2b-256 e8cabdea8c8f2442a4f7c2e301c41b31872e2d29772d9f9f6af3c2185d243f83

See more details on using hashes here.

Provenance

The following attestation bundles were made for kohakuvault-0.8.1-cp313-cp313-macosx_11_0_arm64.whl:

Publisher: release.yml on KohakuBlueleaf/KohakuVault

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file kohakuvault-0.8.1-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for kohakuvault-0.8.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 f9192c729bbd5f73ba57a62925f7861526f1fe7d3cd5ac83948b7ea6e6b598ac
MD5 814ae6a18cab53c8bf19cedaa0bc0da3
BLAKE2b-256 ef0179fdce31f155e006c7e862ee30317c0f0aebf2e44a6234b3f15e661ace35

See more details on using hashes here.

Provenance

The following attestation bundles were made for kohakuvault-0.8.1-cp312-cp312-win_amd64.whl:

Publisher: release.yml on KohakuBlueleaf/KohakuVault

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file kohakuvault-0.8.1-cp312-cp312-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for kohakuvault-0.8.1-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 e6141f9b9c0ae954b80d056d0a8f49afa2d79888bf881f4316782c5b2e0b0b58
MD5 401e490e4152c190a9d364cfacca700e
BLAKE2b-256 3db081ec622cbbd4f2a0a95dfa1aa47c9c53c4bb1e29db7049e179e8dbc7c4e9

See more details on using hashes here.

Provenance

The following attestation bundles were made for kohakuvault-0.8.1-cp312-cp312-manylinux_2_34_x86_64.whl:

Publisher: release.yml on KohakuBlueleaf/KohakuVault

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file kohakuvault-0.8.1-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for kohakuvault-0.8.1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 103b542e6a9ad9d3895290708cb11b5510091d4926e16b673b719836ed05177e
MD5 071a0ae7874b353819d639471f0c40d6
BLAKE2b-256 e12e091a5c8300c39637b000dcbc42d67a78a53793c7ddfbbcfd1101822550c3

See more details on using hashes here.

Provenance

The following attestation bundles were made for kohakuvault-0.8.1-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: release.yml on KohakuBlueleaf/KohakuVault

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file kohakuvault-0.8.1-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for kohakuvault-0.8.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 42c39576483fde355835cfca9cc6d69957690d59993acda81783cea1278675b8
MD5 1bff0160594a1f32b486eb244bca2349
BLAKE2b-256 4c7950b67244a4678b843a03fec0a3047671f10a3887cd6f2242af1392aed747

See more details on using hashes here.

Provenance

The following attestation bundles were made for kohakuvault-0.8.1-cp311-cp311-win_amd64.whl:

Publisher: release.yml on KohakuBlueleaf/KohakuVault

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file kohakuvault-0.8.1-cp311-cp311-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for kohakuvault-0.8.1-cp311-cp311-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 424a0a2a623faa0efe3dd218ee914bfca0b3fb13efb2fe8afe54dda21e69a447
MD5 bcfb91664f5151f776e96258b9bad599
BLAKE2b-256 499fd46c9ff0eddf61d2c45e0e8c9c088481cebde2fa822d7c3710c6c21129e9

See more details on using hashes here.

Provenance

The following attestation bundles were made for kohakuvault-0.8.1-cp311-cp311-manylinux_2_34_x86_64.whl:

Publisher: release.yml on KohakuBlueleaf/KohakuVault

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file kohakuvault-0.8.1-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for kohakuvault-0.8.1-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 51301bd7c274432764ffa80ddcb53bb4f21f9478db6452ebebf53cb0c1edd875
MD5 7babe0f4e7c5da38aa8270eadce85730
BLAKE2b-256 87f0b1778c439111383ff75c4ef67bd08c912eb845d83a48db5019fc3e4214c5

See more details on using hashes here.

Provenance

The following attestation bundles were made for kohakuvault-0.8.1-cp311-cp311-macosx_11_0_arm64.whl:

Publisher: release.yml on KohakuBlueleaf/KohakuVault

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file kohakuvault-0.8.1-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for kohakuvault-0.8.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 7fa0868a9bf9bca9f4c7a20c8329bb011270bcc2dcdd072e6b64293927cdbb5e
MD5 703eb21c00e68f21ee56155aa50c76b8
BLAKE2b-256 f021290b05ac27fbe74a57fd8eec95d1badf292b2251359ed5b9044aa6487a9c

See more details on using hashes here.

Provenance

The following attestation bundles were made for kohakuvault-0.8.1-cp310-cp310-win_amd64.whl:

Publisher: release.yml on KohakuBlueleaf/KohakuVault

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file kohakuvault-0.8.1-cp310-cp310-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for kohakuvault-0.8.1-cp310-cp310-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 69bdbf416ea139452b98d8db1c7e5403af83540787fa087c996eae341864ac4e
MD5 0a0a97bd8cde4637d7f3f2bb59011b40
BLAKE2b-256 2c8bdb9187e8af9a6e0043f6ae1978da57ebd0d6dea367316412a24cab9c8457

See more details on using hashes here.

Provenance

The following attestation bundles were made for kohakuvault-0.8.1-cp310-cp310-manylinux_2_34_x86_64.whl:

Publisher: release.yml on KohakuBlueleaf/KohakuVault

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file kohakuvault-0.8.1-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for kohakuvault-0.8.1-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1b80a8bd8e57b448c598ef41f04b5c9bb95828e65b3ed3ec086f430c17f226d9
MD5 2d4dcaa1dc8b494b83aae2537c88fb53
BLAKE2b-256 d9431d8a9d57fc116ab1ed2f5b2da53d0f9a3fb6985b76b4ec37bddaba6a194f

See more details on using hashes here.

Provenance

The following attestation bundles were made for kohakuvault-0.8.1-cp310-cp310-macosx_11_0_arm64.whl:

Publisher: release.yml on KohakuBlueleaf/KohakuVault

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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