Skip to main content

A blazing-fast, lightweight in-memory vector database built in pure Python.

Project description

PadmaDB 🪷

A blazing-fast, lightweight in-memory vector database built in pure Python and NumPy.

PyPI version Python Supported License: MIT

Pinecone, Milvus, and Weaviate are incredible for enterprise-scale billions of vectors. But when you are building local AI apps, testing RAG pipelines, or running lightweight microservices, spinning up a massive cloud infrastructure is overkill.

PadmaDB solves this by providing a hyper-fast, zero-dependency (beyond NumPy/FastAPI) vector search engine that runs locally and persists to disk.


🚀 Features

  • Pure Python/NumPy Engine: No C++ compilers, Docker containers, or cloud APIs required.
  • Exact Nearest Neighbor (k-NN): Guarantees 100% recall using optimized float32 Cosine Similarity matrix multiplications.
  • RESTful Architecture: Ships with a built-in FastAPI server, allowing it to act as an independent microservice database.
  • Local Persistence: Automatically serializes vector state to your local disk.

📦 Installation

pip install padmadb

⚡ Quickstart

1. Start the Database Server

You can launch the server locally in just a few lines of code:

from padmadb.server import run_server

if __name__ == "__main__":
    # Runs the database engine on [http://0.0.0.0:8000](http://0.0.0.0:8000)
    run_server()

2. Connect and Query (Client SDK)

In a separate Python script or Jupyter Notebook, connect to your local PadmaDB instance to insert and search vectors.

from padmadb import PadmaClient

# Initialize client
client = PadmaClient(host="http://localhost:8000")

# Insert a 384-dimensional vector (e.g., from all-MiniLM-L6-v2)
vector_data = [0.12, -0.45, 0.88] # Truncated for example; must be length 384
client.insert(
    vec_id="doc_1", 
    vector=vector_data, 
    metadata={"text": "Machine learning is fascinating."}
)

# Search for the Top-K nearest neighbors
results = client.search(vector=vector_data, top_k=1)
print(results)

🧠 Architecture & Roadmap

PadmaDB currently utilizes a brute-force exact search mechanism tailored for datasets up to 100,000 vectors, where in-memory matrix multiplication is effectively instantaneous.

Upcoming in v0.2.x:

  • Implementation of threading.Lock() for concurrent write-safety.
  • Transition from JSON persistence to memory-mapped .npy binary arrays for faster cold boots.
  • HNSW (Hierarchical Navigable Small World) indexing for billion-scale querying with O(log N) search times.

🤝 Contributing

PadmaDB is fully open-source. We warmly welcome collaborators, researchers, and cloners!

Want to help build the ultimate local AI database? Clone the repo, fork it, break it, fix it, and submit a PR!

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

padmadb-0.1.3.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

padmadb-0.1.3-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file padmadb-0.1.3.tar.gz.

File metadata

  • Download URL: padmadb-0.1.3.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for padmadb-0.1.3.tar.gz
Algorithm Hash digest
SHA256 f25c3c5afba91c7e1027ae13e10551d892ffe3e141b75b15dacf16d06f8a090c
MD5 56b5917d8206fe8f48d6c946152dc21c
BLAKE2b-256 8560ee46d49531b16e7afdddb1c44faf808dc63cd0eacb55c113b30766d8fc2e

See more details on using hashes here.

File details

Details for the file padmadb-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: padmadb-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 5.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for padmadb-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 462437346aaceed02e20e534f39db73857faab9d258ca05f18dbff133b52d6dc
MD5 f29b1be83d12e60b8c88bb0266298804
BLAKE2b-256 2276fc4bf5055106e692d92a1dc7ce225cbfaa934857a523695c7c9d76da2da3

See more details on using hashes here.

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