quantal (Python)
Embedded, in-memory vector index with 1-bit graph routing, 3-bit TurboQuant payloads, exact rerank, and a ctypes binding to the Zig core.
Install
pip install -e python # from a source checkout (builds libs on demand)
quantal fixes the vector dimension at compile time, so there is one native library per dimension. The binding resolves it automatically, in order:
QUANTAL_LIB: an explicit library path (overrides everything).- Bundled binary: the published wheels carry prebuilt libraries for the
common embedding dimensions (256, 384, 512, 768, 1024, 1536, 3072), so
pip install quantaldbworks with no toolchain for those dims. - Cached build under
~/.cache/quantal/. - Build on demand: from a source checkout with
zigon PATH,Index(dim=N)builds and caches the library for any other dimension.
Common embedding dimensions can use the bundled wheel; any other dimension
needs either a source checkout with auto-build or a manual
zig build -Dc-dim=N + QUANTAL_LIB.
Building wheels
cd python
python build_libs.py # compile bundled dims into quantal/_libs/
python -m build --wheel # -> dist/quantal-...-py3-none-<platform>.whl
build_libs.py --target x86_64-linux-gnu.2.28 pins glibc so the Linux wheel
is manylinux-compatible. Zig cross-compiles directly, no Docker needed. CI in
.github/workflows/wheels.yml builds Linux/macOS/Windows wheels this way.
Core API
import numpy as np
from quantal import Index
with Index(dim=384) as index:
ids = index.add(vectors) # (n, 384) float32 -> auto ids
hits = index.search(query, k=10) # -> [(id, score), ...] cosine
scores, ids, counts = index.search_batch(queries, k=10, threads=0)
index.remove(ids[0])
index.save("docs.tq")
index = Index.load("docs.tq") # dimension read from the file
search_filtered(query, allowlist, k) restricts results to a set of ids. It
uses exact scoring over the allowlist for tenant and ACL filtering.
LangChain
A one-line swap for the in-memory / FAISS store:
from quantal.langchain import QuantalVectorStore
vs = QuantalVectorStore.from_texts(texts, embedding=my_embeddings,
metadatas=metas)
docs = vs.similarity_search("query", k=5)
retriever = vs.as_retriever(search_kwargs={"k": 5})
vs.save("store.qj") # store.qj.tq + store.qj.json
vs = QuantalVectorStore.load("store.qj", embedding=my_embeddings)
Vectors are L2-normalized in and out, so scores are cosine similarity. The
engine stores vectors keyed by id; documents and metadata live in a JSON
sidecar persisted next to the .tq.
LlamaIndex
from quantal.llama_index import QuantalVectorStore
from llama_index.core import VectorStoreIndex, StorageContext
store = QuantalVectorStore() # dim inferred from nodes
ctx = StorageContext.from_defaults(vector_store=store)
index = VectorStoreIndex(nodes, storage_context=ctx, embed_model=embed)
hits = index.as_retriever(similarity_top_k=5).retrieve("query")
LangGraph (agent memory)
A BaseStore with semantic search for local short/long-term memory in
agent graphs. Per-namespace search is served by quantal's exact allowlist
scoring, so namespaces are isolated precisely.
from quantal.langgraph_store import QuantalStore
store = QuantalStore(index={"dims": 384, "embed": embed_fn, "fields": ["text"]})
store.put(("memories", "alice"), "m1", {"text": "prefers dark mode"})
hits = store.search(("memories", "alice"), query="ui preferences", limit=5)
Without an index config it is a plain namespaced key-value store.
Tests
QUANTAL_LIB=... python python/tests/test_index.py
python python/tests/test_langchain.py # needs langchain-core
Metadata
Release files for quantaldb 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
| File | Actions Reset | |||
|---|---|---|---|---|
| quantaldb-0.1.2-py3-none-win_amd64.whl | Python 3 | none | Windows x86-64 | Details for quantaldb-0.1.2-py3-none-win_amd64.whl |
| quantaldb-0.1.2-py3-none-manylinux_2_28_x86_64.whl | Python 3 | none | Linux glibc 2.28+ x86-64 | Details for quantaldb-0.1.2-py3-none-manylinux_2_28_x86_64.whl |
| quantaldb-0.1.2-py3-none-manylinux_2_28_aarch64.whl | Python 3 | none | Linux glibc 2.28+ ARM64 | Details for quantaldb-0.1.2-py3-none-manylinux_2_28_aarch64.whl |
| quantaldb-0.1.2-py3-none-macosx_14_0_arm64.whl | Python 3 | none | macOS 14.0+ ARM64 | Details for quantaldb-0.1.2-py3-none-macosx_14_0_arm64.whl |
Total release size: 40.8 MB
Release files / quantaldb-0.1.2-py3-none-win_amd64.whl
| Download URL | quantaldb-0.1.2-py3-none-win_amd64.whl |
|---|---|
| Size | 6.3 MB |
| Tags | Python 3 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
102444a3c735f48a24f145442557c969e4ea92280a0bdb5d2ac9f2f2d17275fc
|
|
BLAKE2b-256 checksum How to use checksums |
c2e2dd23108bf6c68cf3756351f525617974fc3a3005d24aad6a1b08eb3c0056
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 9, 2026.
Transparency logRelease files / quantaldb-0.1.2-py3-none-manylinux_2_28_x86_64.whl
| Download URL | quantaldb-0.1.2-py3-none-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 25.1 MB |
| Tags | Linux glibc 2.28+ x86-64 Python 3 |
|
SHA-256 checksum How to use checksums |
f58345ad7c70723dd02f46842585a1f676969d4b53f7f9497e4d21fc821fedcd
|
|
BLAKE2b-256 checksum How to use checksums |
08590470a4402aa6b9dc47f3957144b1093def5a4ad45eda5a3f0f671aac134d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 9, 2026.
Transparency logRelease files / quantaldb-0.1.2-py3-none-manylinux_2_28_aarch64.whl
| Download URL | quantaldb-0.1.2-py3-none-manylinux_2_28_aarch64.whl |
|---|---|
| Size | 8.0 MB |
| Tags | Linux glibc 2.28+ ARM64 Python 3 |
|
SHA-256 checksum How to use checksums |
5b8cd032199d97130881f475f75aebe0bbf2e898dc3add6437b8efceefff0eae
|
|
BLAKE2b-256 checksum How to use checksums |
7ada064017abbe8ba222834996fb1b2facba2959180d6e13677735261e561aae
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 9, 2026.
Transparency logRelease files / quantaldb-0.1.2-py3-none-macosx_14_0_arm64.whl
| Download URL | quantaldb-0.1.2-py3-none-macosx_14_0_arm64.whl |
|---|---|
| Size | 1.4 MB |
| Tags | Python 3 macOS 14.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
00dde63fbe89a5b27cf9c81086463a79b9fae36ed8a35f7b6e8f40ce00261038
|
|
BLAKE2b-256 checksum How to use checksums |
65e176ae7cf90fcb865303ae32d2807404f95298c49ab747bbcf8eb6867d01ac
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 9, 2026.
Transparency logSecurity for quantaldb 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 4 files in this release have been uploaded with provenance metadata.
Attestation for quantaldb-0.1.2-py3-none-win_amd64.whl
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 9, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.