Skip to main content

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

Project description

KohakuVault

One-file SQLite datastore with:

  • KVault key-value storage inspired by BoringDB (streaming blobs + auto-pack for dict/list/numpy)
  • 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, 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

# 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).
  • 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.7.1.tar.gz (193.3 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.7.1-cp313-cp313-win_amd64.whl (3.2 MB view details)

Uploaded CPython 3.13Windows x86-64

kohakuvault-0.7.1-cp313-cp313-manylinux_2_34_x86_64.whl (3.8 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.34+ x86-64

kohakuvault-0.7.1-cp313-cp313-macosx_11_0_arm64.whl (3.4 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

kohakuvault-0.7.1-cp312-cp312-win_amd64.whl (3.2 MB view details)

Uploaded CPython 3.12Windows x86-64

kohakuvault-0.7.1-cp312-cp312-manylinux_2_34_x86_64.whl (3.8 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.34+ x86-64

kohakuvault-0.7.1-cp312-cp312-macosx_11_0_arm64.whl (3.4 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

kohakuvault-0.7.1-cp311-cp311-win_amd64.whl (3.2 MB view details)

Uploaded CPython 3.11Windows x86-64

kohakuvault-0.7.1-cp311-cp311-manylinux_2_34_x86_64.whl (3.8 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.34+ x86-64

kohakuvault-0.7.1-cp311-cp311-macosx_11_0_arm64.whl (3.4 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

kohakuvault-0.7.1-cp310-cp310-win_amd64.whl (3.2 MB view details)

Uploaded CPython 3.10Windows x86-64

kohakuvault-0.7.1-cp310-cp310-manylinux_2_34_x86_64.whl (3.8 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.34+ x86-64

kohakuvault-0.7.1-cp310-cp310-macosx_11_0_arm64.whl (3.4 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

File details

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

File metadata

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

File hashes

Hashes for kohakuvault-0.7.1.tar.gz
Algorithm Hash digest
SHA256 f32c836bbc2225e7e3cc92a74c5ea74d3e4759ba004823ca0d8e0ea570c1c122
MD5 54b28ae284f2b17ad1181a5bd86dd3fd
BLAKE2b-256 559aafdb39e67943ad7bdfd91555c3916077382d600e24c7788d27fb2e252a3f

See more details on using hashes here.

Provenance

The following attestation bundles were made for kohakuvault-0.7.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.7.1-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for kohakuvault-0.7.1-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 2ef2b5346b94232bf164ff9bce290c35a3e2da596e395065333b73465f68c787
MD5 e4438253127fc162555f71823b7e2120
BLAKE2b-256 b96172269278a7ed1f4cff292223ce74d1dd6331a93037ffadecbdc80586f724

See more details on using hashes here.

Provenance

The following attestation bundles were made for kohakuvault-0.7.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.7.1-cp313-cp313-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for kohakuvault-0.7.1-cp313-cp313-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 bf7543274b3d931fd2cdea24795bc57a065646e08df81ef7f3d077f3a4fadd37
MD5 2b370f6d8770dfafa58e0f5f9290f6a0
BLAKE2b-256 70930256bb2773c8b67975c6eaeec099d9a6436b7357d5759f539a18972d2f92

See more details on using hashes here.

Provenance

The following attestation bundles were made for kohakuvault-0.7.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.7.1-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for kohakuvault-0.7.1-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ba15846b8f717c592ad69c87a1af7c91d48b27bde4d8a510d70b7c2d412b2e3c
MD5 09b3c3d6a427efd5cf903e94362a7d42
BLAKE2b-256 538695b941b287dc9bd2c9be34b5755a554c7a4264cb17093744c96649396a56

See more details on using hashes here.

Provenance

The following attestation bundles were made for kohakuvault-0.7.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.7.1-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for kohakuvault-0.7.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 6e8074fb6c1d71073ab713ae3f4fdf9235b4ed912fcf01e196c58ab2378529eb
MD5 816e042e7f1a15bdf0c4127c0c5f14e3
BLAKE2b-256 06f669262e334408fb9d9909dae79d722e31f304408f97359bd7082b32eda77c

See more details on using hashes here.

Provenance

The following attestation bundles were made for kohakuvault-0.7.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.7.1-cp312-cp312-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for kohakuvault-0.7.1-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 a008cfc71846c87b6ac7f98bb6e1b7b39cc3ddc7f49df33b43ccfc92eb098c9d
MD5 75033bde9804fcf8defc6edc07dec271
BLAKE2b-256 2c35bc20f839a011df12f63cb7bea20a38c56c7d9b38cb99b8ea4b4bdbd46021

See more details on using hashes here.

Provenance

The following attestation bundles were made for kohakuvault-0.7.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.7.1-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for kohakuvault-0.7.1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ca7242bbdca5c550a724bb5b25702f0d4436e9f0b66082d8b10bbe38c0bfa670
MD5 e432518b8fe0d86686308fcfa0baf447
BLAKE2b-256 eefb57ddbdae679171c2f518d1bcb020f2c9dd393246fb790bd02d8565d31f83

See more details on using hashes here.

Provenance

The following attestation bundles were made for kohakuvault-0.7.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.7.1-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for kohakuvault-0.7.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 7c877e2770396a7013303bd18e1a1b23bd6968e3055fca01bbe629405e71f401
MD5 6453ae3d8d4a6389a27c941174442f5e
BLAKE2b-256 2d8c7a66e5f3ef0b14947374bdb68c5a074d1db2acc24cd6e9c557b91b8a29b6

See more details on using hashes here.

Provenance

The following attestation bundles were made for kohakuvault-0.7.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.7.1-cp311-cp311-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for kohakuvault-0.7.1-cp311-cp311-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 37da19192026c3b8b185e53a2132cbba4d8a28364b2adb21f616e0b0d7236b58
MD5 952990e6ed6f78596843e9a352ac6546
BLAKE2b-256 e66b19d6a71049abf258b3060dfb3d38bd46caf5265f6b63a4471703723efd1a

See more details on using hashes here.

Provenance

The following attestation bundles were made for kohakuvault-0.7.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.7.1-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for kohakuvault-0.7.1-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c41429c0448c36d30ceac8ffc6328efe841fabd8ddb10bdc77d377fa92bc9737
MD5 1d558079c0e9c2f343fb3fa792237626
BLAKE2b-256 762262e38ed16e57df05a4999c508334872ad7ab43ed8e4bcbe9584008dec250

See more details on using hashes here.

Provenance

The following attestation bundles were made for kohakuvault-0.7.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.7.1-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for kohakuvault-0.7.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 c10fbe63cf3b1ce8e811f70b8a05deb40cacd1d3f8f26bf0e39de265a3b21015
MD5 d2fce5931966ec50be740a29aadd2e44
BLAKE2b-256 0981cbd0a860d5a9a0a1a1ca7d726bb4af987208eee85a68b12ceb10893b8540

See more details on using hashes here.

Provenance

The following attestation bundles were made for kohakuvault-0.7.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.7.1-cp310-cp310-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for kohakuvault-0.7.1-cp310-cp310-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 2e2fe6f240f1c74d0ca9771065ce06e79ef5c4abc9b0af2a37660b095fd65096
MD5 a34320b907e78f5fc5561d15b062d2b1
BLAKE2b-256 e26a3c4e3f61a154a46faa8a7f4c1b2da21110572fe53b234812bde743c7fa44

See more details on using hashes here.

Provenance

The following attestation bundles were made for kohakuvault-0.7.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.7.1-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for kohakuvault-0.7.1-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 36ef18b1ce0c2816d8d6e7d0d94b13a702021e23de86d885663878fb0e276c96
MD5 e5fca5fffdf182929476131b4e4d68ba
BLAKE2b-256 a4d94cdf33689aa9307e474f72c8da445bc72034c7e914268e1b1aa130e875ac

See more details on using hashes here.

Provenance

The following attestation bundles were made for kohakuvault-0.7.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