Python bindings for the Valise single-file AI/retrieval archive format.
Project description
valise
Retrieval in one file.
Your RAG prototype works. Now ship it — and suddenly the corpus isn't a thing you have, it's a thing you operate. A vector database container. An index directory that has to travel with the documents and stay consistent with them. A rebuild step in CI. The most valuable artifact you built is the one piece you can't hand to anyone.
SQLite solved this for relational data. Valise does it for retrieval:
documents, a BM25 index, compressed vectors, and the schema describing them, in
one .vls file you copy, version, and query in place.
pip install valise
import numpy as np
from valise import Store, Schema, Record, Search, Vector
store = Store.open("kb.vls") # open-or-create
store.collection("notes", Schema()
.text("body") # English BM25 by default
.vector("dense", Vector(dim=768))) # cosine, auto-calibrated codec
with store.writer() as w:
w.put("notes", "doc-1",
Record().text("body", "portable retrieval capsules")
.vector("dense", embedding)) # float32 ndarray
w.commit() # the durability point
hits = store.search("notes", Search()
.text("body", "retrieval capsule")
.vector("dense", query)
.top_k(10))
print(hits.keys) # ['doc-1']
print(hits.scores) # float32 ndarray
The schema lives in the file. A later run, another process, or another
machine calls Store.open("kb.vls") and searches immediately — nothing to
re-declare, nothing to migrate.
Note that leaving the with block releases the writer lock; it does not
commit. commit() is explicit, and it is the only durability point.
Copy it while it's being written
That's the test that matters. Take a copy of a live corpus mid-write, move it to a machine with a different OS and instruction set, open it there. On a 171,000-document hybrid corpus:
| Valise | Tantivy + USearch | SQLite + FTS5 + vec | |
|---|---|---|---|
| Mid-write copies that opened correctly | 50 / 50 | 4 / 50 | 0 / 50 |
| Artifact | 239 MB, 1 file | 677 MB, 62 files | 865 MB |
Top-10 results come back identical across macOS/ARM and Linux/x86-64, from the same file, with no reconfiguration.
There is no index to build
Every ANN library builds a graph first, and pays again whenever the corpus changes. Valise builds nothing: vectors are stored only as quantized codes, and the candidate-search sketch is derived from those same codes at open — in memory, never written.
At 100k × 768d against recall-matched baselines: 0.50 s to ingest and commit, versus 50 s for FAISS HNSW, 91 s for USearch, 139 s for hnswlib. 90–310× faster to build, and nothing on disk but your data.
The bill: the scan is linear, so a mature HNSW answers individual queries faster. If you build once and serve a billion queries over a static corpus, use a graph. If your corpus changes, travels, or there are thousands of small ones, this trade is the right way round.
Valise does not generate embeddings — bring your own model.
What you get
- Hybrid search. Lexical and vector channels fused at query time, with reciprocal-rank fusion as the default. Text scorers include BM25, TF-IDF cosine, count cosine, approximate cosine variants, and Dice / overlap / containment.
- Compact vectors. QAM Lloyd-Max and UPQ polar codecs at ~5.5 bits per dimension, with NEON and AVX2 kernels. There is no persisted HNSW graph or IVF index — nothing to rebuild, and nothing on disk but the capsule.
- Crash safety. Commits are footer-rooted and atomic: after a crash a reader sees the previous committed state or the new one, never a mixture. Segment payloads carry BLAKE3 checksums.
- Time partitions, tombstones with explicit compaction, and recency as either a ranking signal or a hard filter.
- A typed surface. Full type hints, checked under
mypy --strict, with strict enums rather than magic strings. Vectors cross the FFI boundary zero-copy.
Batch ingest
put_many takes a C-contiguous float32 [N, dim] array and ingests the
whole batch in one native call, rather than a per-row Python loop:
vectors = np.ascontiguousarray(model.encode(bodies), dtype=np.float32)
with store.writer() as w:
w.put_many("notes", keys, vectors, texts=bodies)
w.commit()
Reading everything back
Your data is never locked in. keys() plus get() walks a whole
collection:
r = store.reader()
for key in r.keys("notes"):
print(r.get("notes", key).text)
The valise command-line tool (cargo install valise) does the same from a
shell, including valise export kb.vls > kb.jsonl.
Requirements
Python 3.9 or newer, and NumPy. Wheels are published for Linux and macOS on x86-64 and aarch64.
Windows is not supported yet — the commit protocol relies on positional file IO and fcntl advisory locks, and the Windows equivalents are not implemented.
Status
Pre-1.0 and under active development. Below 1.0, minor versions may break both the API and the on-disk format.
Links
- Documentation — quickstart, concepts, full API reference
- Source — the Rust engine, the on-disk format specification, and the benchmark methodology
- Rust crate
Licensed under MPL-2.0.
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
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file valise-0.1.3.tar.gz.
File metadata
- Download URL: valise-0.1.3.tar.gz
- Upload date:
- Size: 561.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
526568cc23f906d1ba2fdc9bbdb0f207edf89bf2fff32d66be56889ca5eca38a
|
|
| MD5 |
c9c60c2d366dbd470bee4d6295e1056a
|
|
| BLAKE2b-256 |
e88449b0688c9e71c210f9988e7e7998c8726d2fc32867110369096ad9c63f84
|
Provenance
The following attestation bundles were made for valise-0.1.3.tar.gz:
Publisher:
wheels.yml on white07S/valise
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
valise-0.1.3.tar.gz -
Subject digest:
526568cc23f906d1ba2fdc9bbdb0f207edf89bf2fff32d66be56889ca5eca38a - Sigstore transparency entry: 2260037731
- Sigstore integration time:
-
Permalink:
white07S/valise@2cb0aa82f8e5b3043d78a568ee8bd8ff99c7d5e2 -
Branch / Tag:
refs/tags/v0.1.3 - Owner: https://github.com/white07S
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
wheels.yml@2cb0aa82f8e5b3043d78a568ee8bd8ff99c7d5e2 -
Trigger Event:
push
-
Statement type:
File details
Details for the file valise-0.1.3-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: valise-0.1.3-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 1.8 MB
- Tags: CPython 3.9+, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3c448668d7b5b50881648cab805f48ef2e57c63e31b472da227a06e547ad3de0
|
|
| MD5 |
70843275efac32bc4e8bdd6741830a0d
|
|
| BLAKE2b-256 |
e3379efd222ee344e9e1c8f88b54642ab2cfb4ca7789e2a4c4978cc38b44e9fd
|
Provenance
The following attestation bundles were made for valise-0.1.3-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:
Publisher:
wheels.yml on white07S/valise
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
valise-0.1.3-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl -
Subject digest:
3c448668d7b5b50881648cab805f48ef2e57c63e31b472da227a06e547ad3de0 - Sigstore transparency entry: 2260037757
- Sigstore integration time:
-
Permalink:
white07S/valise@2cb0aa82f8e5b3043d78a568ee8bd8ff99c7d5e2 -
Branch / Tag:
refs/tags/v0.1.3 - Owner: https://github.com/white07S
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
wheels.yml@2cb0aa82f8e5b3043d78a568ee8bd8ff99c7d5e2 -
Trigger Event:
push
-
Statement type:
File details
Details for the file valise-0.1.3-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: valise-0.1.3-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 1.6 MB
- Tags: CPython 3.9+, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ab7d8e711798221d19e12550f891b815a48f5a279ad136d1999e6d83e715f8a5
|
|
| MD5 |
6c80c5f6c2b376ecf9eb7414959be382
|
|
| BLAKE2b-256 |
ee9a988ef35d7d5bdc1055df7de2aa9fcf9a72cab8d66e5f6c3bca92d26350bb
|
Provenance
The following attestation bundles were made for valise-0.1.3-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:
Publisher:
wheels.yml on white07S/valise
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
valise-0.1.3-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl -
Subject digest:
ab7d8e711798221d19e12550f891b815a48f5a279ad136d1999e6d83e715f8a5 - Sigstore transparency entry: 2260037770
- Sigstore integration time:
-
Permalink:
white07S/valise@2cb0aa82f8e5b3043d78a568ee8bd8ff99c7d5e2 -
Branch / Tag:
refs/tags/v0.1.3 - Owner: https://github.com/white07S
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
wheels.yml@2cb0aa82f8e5b3043d78a568ee8bd8ff99c7d5e2 -
Trigger Event:
push
-
Statement type:
File details
Details for the file valise-0.1.3-cp39-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: valise-0.1.3-cp39-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 1.5 MB
- Tags: CPython 3.9+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3808192879f5263a56f9f8f07982fb4c8a466db597eeaea4f4113b946b975634
|
|
| MD5 |
af0ec72cbe7bfb84b9868e585eba06e9
|
|
| BLAKE2b-256 |
6d625685845a85c644b70723501f5811b8ddbcf3a0291f2281a0591e9e6cb71c
|
Provenance
The following attestation bundles were made for valise-0.1.3-cp39-abi3-macosx_11_0_arm64.whl:
Publisher:
wheels.yml on white07S/valise
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
valise-0.1.3-cp39-abi3-macosx_11_0_arm64.whl -
Subject digest:
3808192879f5263a56f9f8f07982fb4c8a466db597eeaea4f4113b946b975634 - Sigstore transparency entry: 2260037746
- Sigstore integration time:
-
Permalink:
white07S/valise@2cb0aa82f8e5b3043d78a568ee8bd8ff99c7d5e2 -
Branch / Tag:
refs/tags/v0.1.3 - Owner: https://github.com/white07S
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
wheels.yml@2cb0aa82f8e5b3043d78a568ee8bd8ff99c7d5e2 -
Trigger Event:
push
-
Statement type:
File details
Details for the file valise-0.1.3-cp39-abi3-macosx_10_12_x86_64.whl.
File metadata
- Download URL: valise-0.1.3-cp39-abi3-macosx_10_12_x86_64.whl
- Upload date:
- Size: 1.7 MB
- Tags: CPython 3.9+, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fb5528d8894ca974b738f278259c681e756dcc1464fbc6cc39c511c7b2041173
|
|
| MD5 |
d466beba4910921619f5395095db8008
|
|
| BLAKE2b-256 |
a74cc97ccfd4a556ae1bf5fe66f33579aab714f5736ac62960ee69768e050ffb
|
Provenance
The following attestation bundles were made for valise-0.1.3-cp39-abi3-macosx_10_12_x86_64.whl:
Publisher:
wheels.yml on white07S/valise
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
valise-0.1.3-cp39-abi3-macosx_10_12_x86_64.whl -
Subject digest:
fb5528d8894ca974b738f278259c681e756dcc1464fbc6cc39c511c7b2041173 - Sigstore transparency entry: 2260037782
- Sigstore integration time:
-
Permalink:
white07S/valise@2cb0aa82f8e5b3043d78a568ee8bd8ff99c7d5e2 -
Branch / Tag:
refs/tags/v0.1.3 - Owner: https://github.com/white07S
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
wheels.yml@2cb0aa82f8e5b3043d78a568ee8bd8ff99c7d5e2 -
Trigger Event:
push
-
Statement type: