Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

SurgeDB Python

PyPI Python versions License

SurgeDB is a high-performance, embedded vector database for Python. It runs entirely locally—no Docker containers, no external APIs, and no complex setup required.

Built in Rust and powered by SIMD-accelerated HNSW indices, SurgeDB offers millisecond-latency vector search with a minimal memory footprint.


Key Features

  • 🚀 Blazing Fast: Hand-tuned AVX-512 and NEON kernels for maximum throughput.
  • 🧠 Memory Efficient: Built-in SQ8 (4x) and Binary (32x) quantization. Index millions of vectors on a laptop.
  • 📦 Embedded: Runs in-process. Just pip install and go.
  • 💾 Persistent: ACID-compliant storage with Write-Ahead Logs (WAL) and crash-safe snapshots.
  • 🔍 Rich Filtering: Filter search results by metadata (exact match, comparison, logical operators).

Installation

pip install surgedb

Quick Start

from surgedb import SurgeClient, SurgeConfig, DistanceMetric, Quantization

# 1. Initialize a persistent database
config = SurgeConfig(
    dimensions=384,                     # e.g., for all-MiniLM-L6-v2
    distance_metric=DistanceMetric.COSINE,
    quantization=Quantization.SQ8,      # 4x compression
    persistent=True,
    data_path="./my_vector_db"
)
db = SurgeClient.open("./my_vector_db", config)

# 2. Insert data (ID, Vector, Metadata)
db.insert(
    "doc_1", 
    [0.1, 0.2, 0.3, ...],               # 384-dim list or numpy array
    '{"title": "How to train your dragon", "tag": "movie"}'
)

# 3. Search with metadata filtering
results = db.search_with_filter(
    query=[0.1, 0.2, 0.3, ...], 
    k=5, 
    filter={'Exact': {'field': 'tag', 'value': 'movie'}}
)

for result in results:
    print(f"ID: {result.id}, Score: {result.score:.4f}")

Advanced Usage

Batch Operations

For maximum write throughput, use upsert_batch.

vectors = []
for i in range(1000):
    vectors.append({
        "id": f"vec_{i}",
        "vector": [0.1] * 384,
        "metadata": {"index": i}
    })

db.upsert_batch(vectors)

Metadata Filtering

SurgeDB supports a structured query language for filtering.

from surgedb import SearchFilter

# Find movies released after 2020 OR in the "Sci-Fi" genre
filter_query = SearchFilter.Or([
    SearchFilter.Comparison(field="year", operator="gt", value=2020),
    SearchFilter.Exact(field="genre", value="Sci-Fi")
])

results = db.search_with_filter(query_vec, 10, filter_query)

Performance

SurgeDB is designed to outperform pure-Python solutions and compete with heavy C++ vector stores, while remaining lightweight.

Metric Performance
Search Latency < 1ms (1M vectors, SQ8)
Indexing Speed ~20k vectors/sec
Memory (1M vectors) ~120MB (SQ8) vs ~4GB (Float32)
Cold Start < 50ms

Development

If you want to contribute to the bindings or build from source:

Prerequisites

  • Rust toolchain (stable)
  • Python 3.7+
  • maturin build tool

Building from Source

# Install maturin
pip install maturin

# Build and install locally
maturin develop --release -m crates/surgedb-bindings/Cargo.toml

Generating Bindings (UniFFI)

The bindings are automatically generated using UniFFI.

cd crates/surgedb-bindings
make generate-python

Metadata

Release files for surgedb 1.0.0a5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for surgedb 1.0.0a5
File Size Uploaded Provenance
surgedb-1.0.0a5.tar.gz 85.5 kB With provenance Details

Built distributions (wheels)

Table of built distributions (wheels) for surgedb 1.0.0a5
File
surgedb-1.0.0a5-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details
surgedb-1.0.0a5-py3-none-manylinux_2_34_x86_64.whl Python 3 none Linux glibc 2.34+ x86-64 Details
surgedb-1.0.0a5-py3-none-manylinux_2_34_aarch64.whl Python 3 none Linux glibc 2.34+ ARM64 Details
surgedb-1.0.0a5-py3-none-macosx_11_0_arm64.whl Python 3 none macOS 11.0+ ARM64 Details
surgedb-1.0.0a5-py3-none-macosx_10_12_x86_64.whl Python 3 none macOS 10.12+ x86-64 Details

Total release size: 2.0 MB

Release files / surgedb-1.0.0a5.tar.gz

Download URL surgedb-1.0.0a5.tar.gz
Size 85.5 kB
Tags Source
SHA-256 checksum
How to use checksums
a6975c1d69b3008977eb12b8ebd79f378f9eceb18092f6e6aa1d5146a0cdc959
BLAKE2b-256 checksum
How to use checksums
473a8a91512b1df22ad201ae929f07ede2636efe6c92044ef4c37d5c530e3849
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Jan 31, 2026.

Transparency log

Release files / surgedb-1.0.0a5-py3-none-win_amd64.whl

Download URL surgedb-1.0.0a5-py3-none-win_amd64.whl
Size 300.9 kB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
77efa18893a45120067ca6cadf1b33369a1c6767010c3dc4d5d45e024d89712b
BLAKE2b-256 checksum
How to use checksums
b23489ea02da12c64d9c231817fb5daa8ad01559d14c4f98659de4e39a5e0495
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Jan 31, 2026.

Transparency log

Release files / surgedb-1.0.0a5-py3-none-manylinux_2_34_x86_64.whl

Download URL surgedb-1.0.0a5-py3-none-manylinux_2_34_x86_64.whl
Size 434.7 kB
Tags Linux glibc 2.34+ x86-64 Python 3
SHA-256 checksum
How to use checksums
1367e2f0becbae6e0b370b5c88694e4878513369c0d68f373c8ac37df90dabe0
BLAKE2b-256 checksum
How to use checksums
cd874fc615d2081551a19b68e662715bbd9b21fb7ba280dcc67d159a1f0b8da6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Jan 31, 2026.

Transparency log

Release files / surgedb-1.0.0a5-py3-none-manylinux_2_34_aarch64.whl

Download URL surgedb-1.0.0a5-py3-none-manylinux_2_34_aarch64.whl
Size 425.6 kB
Tags Linux glibc 2.34+ ARM64 Python 3
SHA-256 checksum
How to use checksums
7b10ccd4848e65dd499f3d097a47c77e3af0ea095434e9c72a1d6355a1eaf62f
BLAKE2b-256 checksum
How to use checksums
3ecf0a386dfcd1afc82ef0f8afde108ae9467748b48ff2f233faa3d581340ff5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Jan 31, 2026.

Transparency log

Release files / surgedb-1.0.0a5-py3-none-macosx_11_0_arm64.whl

Download URL surgedb-1.0.0a5-py3-none-macosx_11_0_arm64.whl
Size 388.3 kB
Tags Python 3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
363ecb3a41afe33a163cd8d401dd3ece3d8d57101b9da42e3f22f2608a5f039a
BLAKE2b-256 checksum
How to use checksums
cac43a01adde00bf13701ceb9ee867157b17b3c4aa96b5032c59ba553688feda
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Jan 31, 2026.

Transparency log

Release files / surgedb-1.0.0a5-py3-none-macosx_10_12_x86_64.whl

Download URL surgedb-1.0.0a5-py3-none-macosx_10_12_x86_64.whl
Size 405.1 kB
Tags Python 3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
7e55a1e8c140b2668202455137692884c63e57b0d038034505c6b1f52f4fb240
BLAKE2b-256 checksum
How to use checksums
f9884e627a940e5a04476a5f946b3078b80ad3227372cb26a9fba1244bc7f002
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Jan 31, 2026.

Transparency log

Security for surgedb 1.0.0a5

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 6 files in this release have been uploaded with provenance metadata.

Select from 6 files

Attestation for surgedb-1.0.0a5.tar.gz

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 Jan 31, 2026.

Transparency log

A 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page