Python snapshot search
annexdb.Index loads an ANNex core Segment snapshot and provides native
single-query and batch HNSW search. Python 3.9+ and NumPy are required.
The multivector HTTP API owns hybrid
queries and collections; this binding currently exposes snapshot search only.
Install from PyPI:
python -m pip install ANNexDB
To build from source, run this from the workspace root in an activated virtual environment:
python -m pip install 'maturin>=1.8,<2' numpy
maturin develop --release --manifest-path python/annex-py/Cargo.toml
import annexdb
import numpy as np
index = annexdb.Index("segment.bin", quantize=False)
query = np.zeros(index.dim(), dtype=np.float32) # replace with your embedding
ids, scores = index.search(query, k=10, ef=128)
ids, scores = index.search_batch(query[None, :], k=10, ef=128, threads=4)
Inputs must be C-contiguous float32 NumPy arrays with the index's dimension and
finite values. Inputs are copied before releasing the GIL; batch workers are
capped to available hardware threads. Single searches return up to k results.
Batches have shape (queries, k) and pad missing matches with uint64's maximum
value and NaN. Empty batches and k=0 preserve these shapes. Combined batch
output is limited to 1 GiB; oversized shapes raise OverflowError before native
allocation. Errors propagate to Python rather than becoming empty result rows.
Scores retain the snapshot metric: squared Euclidean distance is lower-is-better;
cosine and dot-product similarities are higher-is-better. SQ8 screening requires
loading with quantize=True and querying with sq8_screen=True. Runtime options
scan_cap and patience keep the core search meanings; results remain approximate.
CI builds and installs the wheel on Linux and macOS, generates a deterministic Rust snapshot, and checks the Python results against an independent NumPy oracle:
cargo run -p annex-py --example make_test_fixture -- /tmp/annex-fixture.bin
ANNEX_TEST_SNAPSHOT=/tmp/annex-fixture.bin \
python -m unittest discover -s python/annex-py/tests -v
Metadata
Release files for ANNexDB 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| annexdb-0.2.0-cp39-abi3-win_amd64.whl | CPython 3.9 | abi3 | Windows x86-64 | Details |
| annexdb-0.2.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl | CPython 3.9 | abi3 | Linux glibc 2.17+ x86-64 | Details |
| annexdb-0.2.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl | CPython 3.9 | abi3 | Linux glibc 2.17+ ARM64 | Details |
| annexdb-0.2.0-cp39-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl | CPython 3.9 | abi3 | macOS 10.12+ universal2 (ARM64, x86-64), macOS 10.12+ x86-64, macOS 11.0+ ARM64 | Details |
Total release size: 2.9 MB
Release files / annexdb-0.2.0-cp39-abi3-win_amd64.whl
| Download URL | annexdb-0.2.0-cp39-abi3-win_amd64.whl |
|---|---|
| Size | 455.1 kB |
| Tags | CPython 3.9 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
6d94033859d63c503b39f68bc3095d8eac585e8ce99a7439b92ab9d2591f0efe
|
|
BLAKE2b-256 checksum How to use checksums |
caa26a92738a285f6d85a3ff4606f9dca8c4011b02d09263eb6d3e626aff912a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Sep 30, 2026.
Transparency logRelease files / annexdb-0.2.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | annexdb-0.2.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 653.7 kB |
| Tags | CPython 3.9 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
db794e24a5775d0fe8205c3354c145b5a2951dbf8ecb2e4fb64988de6f698795
|
|
BLAKE2b-256 checksum How to use checksums |
300d8266868a14ca7d54dbfed470a193ca9908d3eb4a5f013b558c6e41fac6b8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Sep 30, 2026.
Transparency logRelease files / annexdb-0.2.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | annexdb-0.2.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 650.6 kB |
| Tags | CPython 3.9 Linux glibc 2.17+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
9ecc25bde8287b11e2373137d557440d20487a4124f3e600482345eebe735378
|
|
BLAKE2b-256 checksum How to use checksums |
df42a6c3c1247ec93399a76f4d5457c8fcebc8584953cb113955f83726a4aeac
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Sep 30, 2026.
Transparency logRelease files / annexdb-0.2.0-cp39-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
| Download URL | annexdb-0.2.0-cp39-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl |
|---|---|
| Size | 1.2 MB |
| Tags | CPython 3.9 abi3 macOS 10.12+ universal2 (ARM64, x86-64) macOS 10.12+ x86-64 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
16724f5ca3915319dd917c274cde77266fdb0abbcc4b0ff6e30320fce3efc4ef
|
|
BLAKE2b-256 checksum How to use checksums |
521ed4e8c5faa3c0a9d639ff764c5be673c37b037146d7f3601d2fd5700cf06b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Sep 30, 2026.
Transparency log