iscc-usearch
A vector search library extending USearch with sharded indexes, variable-length binary vectors, and 128-bit keys.
Looking for a ready-to-use ISCC search engine with CLI and REST API? See iscc-search, which uses iscc-usearch internally.
iscc-usearch is a Python library that extends USearch - a
high-performance HNSW library adopted by
ClickHouse, LangChain, and others - with three independent capabilities:
Sharded HNSW indexes (ShardedIndex) keep a single active shard in RAM for writes while
completed shards are memory-mapped for reads. Works with any vector type and metric USearch
supports, including user-defined distance functions. Insert throughput stays consistent and memory
stays bounded as the index grows to billions of vectors.
Normalized Prefix Hamming Distance (NphdIndex, ShardedNphdIndex) compares binary vectors
of mixed bit-lengths - a 64-bit query finds nearest neighbors among 256-bit vectors with
comparable distances. Purpose-built for ISCC (ISO 24138) content
fingerprints, also applicable to Matryoshka embeddings,
perceptual hashes, and locality-sensitive hashing.
128-bit UUID keys (ShardedIndex128, ShardedNphdIndex128) extend the key space from 64-bit
integers to 128-bit bytes(16) keys. Useful when your identifiers are UUIDs, 128-bit hashes, or
structured multi-part keys that don't fit in a uint64.
Key features:
- Bounded memory - only one shard in RAM at a time, the rest memory-mapped
- Billions of vectors - sharded indexes scale well beyond single-machine RAM
- Full CRUD - add, remove, upsert, compact, and dirty-counter-driven flush across index variants
- Durable saves - buffer-then-write persistence with atomic rename and stable-storage flushes
- Diagnostics -
ShardedIndex.stats()for structured monitoring snapshots - Mixed bit-lengths - 64-bit and 256-bit vectors coexist in the same index
- 128-bit keys -
bytes(16)UUID keys when 64-bit integers are not enough - Any distance metric - user-defined metrics via USearch's plugin system
- Fast - inherits USearch's HNSW engine, benchmarked at 10x the throughput of FAISS
Which index class?
| Class | Var-len | Keys | Shards | Use when... |
|---|---|---|---|---|
NphdIndex |
✓ | uint64 | — | Binary variable-length, fits in RAM |
ShardedIndex |
— | uint64 | ✓ | Exceeds RAM, any metric |
ShardedIndex128 |
— | 128-bit | ✓ | Same, with 128-bit keys |
ShardedNphdIndex |
✓ | uint64 | ✓ | Binary variable-length, exceeds RAM |
ShardedNphdIndex128 |
✓ | 128-bit | ✓ | Binary variable-length, 128-bit keys |
Installation
pip install iscc-usearch
Quick start
Variable-length binary (NphdIndex):
import numpy as np
from iscc_usearch import NphdIndex
index = NphdIndex(max_dim=256)
# Mix 64-bit and 128-bit vectors in the same index
index.add(1, np.array([255, 128, 64, 32, 16, 8, 4, 2], dtype=np.uint8))
index.add(2, np.array([255, 128, 64, 32, 16, 8, 4, 2, 1, 0, 255, 128, 64, 32, 16, 8], dtype=np.uint8))
# Search with a 64-bit query - NPHD compares the common prefix
query = np.array([255, 128, 64, 32, 16, 8, 4, 2], dtype=np.uint8)
matches = index.search(query, count=2)
print(matches.keys) # Nearest neighbor keys
print(matches.distances) # NPHD distances in [0.0, 1.0]
Sharded HNSW (ShardedIndex):
import numpy as np
from iscc_usearch import ShardedIndex
# Shards are stored in a directory on disk
index = ShardedIndex(ndim=64, path="my_index", dtype="f32")
# Add vectors - shards rotate automatically when size limit is reached
keys = list(range(1000))
vectors = np.random.rand(1000, 64).astype(np.float32)
index.add(keys, vectors)
# Search across all shards
matches = index.search(vectors[0], count=10)
print(matches.keys) # Nearest neighbor keys
print(matches.distances) # Cosine distances
Documentation
Full documentation: https://usearch.iscc.codes/
- Tutorials - Step-by-step getting started guides
- How-to Guides - Persistence, sharding, upsert, bloom filters
- Explanation - NPHD metric, architecture, performance
- API Reference - Auto-generated from source
- Development - Dev setup, testing, and contribution guidelines
License
Apache-2.0
Metadata
Release files for iscc-usearch 0.8.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 | Provenance | Actions |
|---|---|---|---|---|
| iscc_usearch-0.8.1.tar.gz | 44.7 kB | Without provenance | Details for iscc_usearch-0.8.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| iscc_usearch-0.8.1-py3-none-any.whl | Python 3 | none | any | Details for iscc_usearch-0.8.1-py3-none-any.whl |
Total release size: 93.3 kB
Release files / iscc_usearch-0.8.1.tar.gz
| Download URL | iscc_usearch-0.8.1.tar.gz |
|---|---|
| Size | 44.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
659b4ecd137988e34694f9bedbac380fe1c3696677618e03609639bcd34dac54
|
|
BLAKE2b-256 checksum How to use checksums |
ec135929d854b191901408365737cbd3b4d4d74b5a8b0695d6d447db17912288
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.1 {"installer":{"name":"uv","version":"0.12.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / iscc_usearch-0.8.1-py3-none-any.whl
| Download URL | iscc_usearch-0.8.1-py3-none-any.whl |
|---|---|
| Size | 48.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
05f040cc3d85570c209ba4e81bfc2aaa2d3c376e48ab3aa72caeceac89d92f0d
|
|
BLAKE2b-256 checksum How to use checksums |
f3d2b75244f46abf7cf99dbc2e013d8a89b2c549aa005ebc9c1d6d0cdf8ea4b3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.1 {"installer":{"name":"uv","version":"0.12.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for iscc-usearch 0.8.1
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.