Embedded, single-file, in-process vector database.
Project description
veclite
Embedded, single-file, in-process vector database — Python binding (SPEC-009).
pip install veclite installs a prebuilt abi3 wheel (CPython 3.9+); no Rust
toolchain is needed. NumPy is optional but recommended for zero-copy vectors.
pip install veclite # core
pip install "veclite[numpy]" # + numpy extra
Quickstart
import veclite
db = veclite.Database.memory() # or Database.open("data.veclite")
docs = db.create_collection("docs", dimension=3, metric="euclidean")
docs.upsert("a", [1.0, 0.0, 0.0], {"lang": "en"})
docs.upsert("b", [0.0, 1.0, 0.0])
hits = docs.search([0.9, 0.1, 0.0], limit=5) # -> [{id, score, payload, vector?}]
page = docs.scroll(limit=100) # -> {points, next_cursor}
NumPy float32 arrays are borrowed without a Python-side copy on search and
upsert_batch (PY-020); the GIL is released around every core call so searches
from multiple threads run in parallel (PY-030).
Custom embedders
Register any Python object with embed(text) and a dimension property; auto-
embed collections then route text through it. embed_batch, fit,
export_state, and import_state are used when present. Exceptions raised in the
callback surface as a VecLiteError with the original exception chained
(__cause__).
import numpy as np
class MyEmbedder:
@property
def dimension(self): return 384
def embed(self, text: str) -> np.ndarray:
... # return a float32 vector of length `dimension`
db.register_embedder("mine", MyEmbedder())
col = db.create_collection("t", dimension=384, embedding_provider="mine")
col.upsert_text("d1", "hello world")
hits = col.search_text("hello", limit=5)
A Python embedder is not persisted — only its serialized state. After reopening a database that uses one, re-register it under the same name before use.
Async (veclite.aio)
The optional veclite.aio facade mirrors the sync surface with async methods
that run the blocking core on the asyncio thread pool. Because the core is
GIL-free, awaits overlap. It imports lazily, so synchronous use pays nothing.
import asyncio, veclite
async def main():
db = veclite.aio.memory()
docs = await db.create_collection("docs", dimension=3)
await docs.upsert("a", [1.0, 0.0, 0.0])
hits = await docs.search([1.0, 0.0, 0.0], limit=5)
asyncio.run(main())
Errors
Every veclite.VecLiteError subclass (CollectionNotFound, DimensionMismatch,
Locked, InvalidArgument, IoError, …) carries the identical message as the
Rust core (PY-040). Catch the base veclite.VecLiteError to handle any of them.
License
Apache-2.0.
Project details
Release history Release notifications | RSS feed
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 hivellm_veclite-0.1.1.tar.gz.
File metadata
- Download URL: hivellm_veclite-0.1.1.tar.gz
- Upload date:
- Size: 2.4 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aadc710cfe72b1ba22390817f69e35680256170dd681fc456248d99737520432
|
|
| MD5 |
daf670d13c2e35fe73cffac78fe1f428
|
|
| BLAKE2b-256 |
07a3d7ad5846496ffeacf46235bc07c1051ff651691f342bd2dc8c981ad5a270
|
File details
Details for the file hivellm_veclite-0.1.1-cp39-abi3-win_amd64.whl.
File metadata
- Download URL: hivellm_veclite-0.1.1-cp39-abi3-win_amd64.whl
- Upload date:
- Size: 2.1 MB
- Tags: CPython 3.9+, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b5dd514b60c62f10d0876420caee4b6d1182d32053d7b1b69f3f93621dba23eb
|
|
| MD5 |
d9ad26bb8a13ec294d99983b4bf889f0
|
|
| BLAKE2b-256 |
c16f8610556e3f98475795127d796ef1905defe2bdfe9d4444d228783ba0b59a
|
File details
Details for the file hivellm_veclite-0.1.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: hivellm_veclite-0.1.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 2.5 MB
- Tags: CPython 3.9+, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
73133389cf89cb64d0d9ca30b366a6eb232ab9df07b807553025626c79815f20
|
|
| MD5 |
597c901b4f6e574df42451c1e07dd582
|
|
| BLAKE2b-256 |
9750e36c807fe78cbb64f1cdaf58334695dc19faa43765afc82ad2c065939925
|
File details
Details for the file hivellm_veclite-0.1.1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: hivellm_veclite-0.1.1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 2.5 MB
- Tags: CPython 3.9+, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ccf60886a4cc31caac4e1e8eec39dc053cfa68a214a10ccd995683daf368ca68
|
|
| MD5 |
7b2493288b2e837e221beffe74a89fad
|
|
| BLAKE2b-256 |
a15db5058c55ced2b0269f4cd80425918f794a455ae89cbe8ff1e0e7636074dd
|