🐹 NoPokeDB
A tiny, disk-backed vector database built on hnswlib (for approximate nearest neighbor search) and SQLite (for metadata).
Simple, lightweight, and crash-safe — good for prototypes, side projects, or when you don’t want a heavyweight vector DB service.
✨ Features
- Durable: HNSW index + SQLite metadata, persisted on disk
- Crash safety: write-ahead oplog with replay
- Fast: batch inserts, bulk metadata fetch, auto-resize index
- Flexible metrics: cosine / L2 / inner product
- CRUD:
add,add_many,get,delete,upsert - Consistent scoring: higher = better for all metrics (with raw
distanceincluded)
📦 Installation
pip install nopokedb
🚀 Quickstart
import numpy as np
from nopokedb import NoPokeDB
# Create (or load existing) DB with 128-d vectors
db = NoPokeDB(dim=128, max_elements=10_000, path="./vdb_data", space="cosine")
# Insert one vector
vec = np.random.rand(128).astype(np.float32)
vid = db.add(vec, metadata={"name": "foo"})
# Insert many at once (faster)
V = np.random.rand(5, 128).astype(np.float32)
metas = [{"i": i} for i in range(len(V))]
ids = db.add_many(V, metas)
# Query nearest neighbors
q = np.random.rand(128).astype(np.float32)
hits = db.query(q, k=3)
for h in hits:
print(h["id"], h["score"], h["metadata"])
# Get / update / delete
print(db.get(vid))
db.upsert(vid, metadata={"name": "bar"})
db.delete(ids[0])
# Persist & close
db.save()
db.close()
Example query result:
{'id': 0, 'metadata': {'name': 'foo'}, 'score': 0.991, 'distance': 0.009}
🛠 Development
Bump version
The Makefile automates version bumps in pyproject.toml and src/nopokedb/__init__.py:
make bump V=0.2.0
That will:
- update both files
- commit with message
Bump to v0.2.0 - tag
v0.2.0 - push tag + main branch
Publish to PyPI
-
Set your API key once:
export PYPI_API_KEY=your-pypi-token
-
Build + upload:
make publish
📜 License
MIT
Metadata
Release files for nopokedb 0.5.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| nopokedb-0.5.1.tar.gz | 8.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| nopokedb-0.5.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 15.9 kB
Release files / nopokedb-0.5.1.tar.gz
| Download URL | nopokedb-0.5.1.tar.gz |
|---|---|
| Size | 8.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
389e0c9f926391b3cffe93093d2f666d70673b592c4809a4698c7a4957c960ca
|
|
BLAKE2b-256 checksum How to use checksums |
078e365be59e9b5ed546792ee6f407b56d95683bbafc52c1b229c37a5767af29
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.11
|
Release files / nopokedb-0.5.1-py3-none-any.whl
| Download URL | nopokedb-0.5.1-py3-none-any.whl |
|---|---|
| Size | 6.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
649cbb444a5d76d857636c7d5e67e4dd42580e0fed2641d59af187d98d4cef3b
|
|
BLAKE2b-256 checksum How to use checksums |
c925d404f8aae27f95a2f2561e5d8b203d0bcec9361a7773f750bcee3c7285d7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.11
|