Version-dispatched cuVS backend loader for Lance
Project description
pylance-cuvs
pylance-cuvs provides cuVS-backed IVF_PQ training and artifact building for
Lance datasets.
The current release line is 0.1.0b2.
It covers one narrow part of the indexing pipeline:
- Train an IVF_PQ model with cuVS.
- Build a partition-local artifact from a Lance dataset.
- Pass the training output and artifact back to Lance for finalization.
It does not create or register a Lance index on your behalf.
Requirements
- Linux
- Python 3.12+
- CUDA 12 runtime available on the machine
- cuVS runtime
libcuvs-cu12==26.2.0 - A matching backend package:
pylance-cuvs-cu12 - A Lance build at commit
6112a34bfe38618f07c099217dc3d89fd39ca6bbor a descendant that preserves the same vector-build APIs
Installation
Install the loader, the matching backend package, and the cuVS runtime into the same Python environment:
pylance-cuvspylance-cuvs-cu12libcuvs-cu12==26.2.0
Published beta releases are wheel-only. Source distributions are not supported.
If you are working from this repository, the shortest local setup is:
just sync-dev
just backend-develop
For Lance-side integration, pin Lance to commit
6112a34bfe38618f07c099217dc3d89fd39ca6bb first, then validate against this
beta.
The loader chooses the backend from the installed cuVS runtime package. You can override detection when needed:
export LANCE_CUVS_BACKEND=cu12
Legacy overrides such as cuvs-26-02 are still accepted for compatibility.
Quick Start
from pathlib import Path
import lance
import lance_cuvs
import pyarrow as pa
def vector_array(rows: int, dim: int) -> pa.FixedSizeListArray:
values = pa.array(
[row + axis / 100.0 for row in range(rows) for axis in range(dim)],
type=pa.float32(),
)
return pa.FixedSizeListArray.from_arrays(values, dim)
dataset_uri = Path("/tmp/example.lance")
artifact_uri = Path("/tmp/example-artifact")
table = pa.table({"vector": vector_array(rows=4096, dim=16)})
lance.write_dataset(table, dataset_uri)
training = lance_cuvs.train_ivf_pq(
dataset_uri,
"vector",
metric_type="L2",
num_partitions=8,
num_sub_vectors=4,
sample_rate=4,
max_iters=20,
)
artifact = lance_cuvs.build_ivf_pq_artifact(
dataset_uri,
"vector",
training=training,
artifact_uri=artifact_uri,
)
print(type(training.ivf_centroids()))
print(type(training.pq_codebook()))
print(artifact.artifact_uri)
print(artifact.files)
Python API
lance_cuvs.train_ivf_pq(...)
Trains an IVF_PQ model with cuVS and returns IvfPqTrainingOutput.
Key fields and methods:
num_partitionsnum_sub_vectorsnum_bitsmetric_typeivf_centroids()->pyarrow.FixedSizeListArraypq_codebook()->pyarrow.FixedSizeListArray
lance_cuvs.build_ivf_pq_artifact(...)
Builds a partition-local artifact from a Lance dataset and a previously trained
model, then returns IvfPqArtifactOutput.
Key fields:
artifact_urifiles
artifact_uri must resolve to the local filesystem.
Scope
Use pylance-cuvs when you want cuVS to do the expensive GPU-side training and
encoding work, but you still want Lance to own index finalization.
Do not expect this package to:
- finalize an index
- register an index in a dataset
- provide a generic Lance wrapper beyond IVF_PQ training and artifact build
Development
List available tasks with:
just
Run commands inside the shared development container with:
just container-shell
Use --platform linux/amd64 only when you explicitly want to match the
GitHub-hosted runner architecture:
tools/run_in_container.sh --platform linux/amd64 -- bash
Run the CI-equivalent CPU build locally with:
just container-python-build
Run the Rust quality gates locally with:
just container-rust-build
Build all release wheels locally with:
just container-python-release
Create the root development environment with:
just sync-dev
Run loader-only tests with:
just loader-test
Build the root and backend wheels with:
just build-wheels
Test the published root wheel in a clean environment with:
just test-loader-wheel
Test the published wheels on a GPU-capable machine with:
just test-gpu-wheel
Build only the backend wheel with:
just backend-wheel
Build the cu12 backend in-place with:
just backend-develop
Run the Rust formatting check with:
just rust-fmt-check
Run Clippy with the Python bindings enabled:
just rust-clippy
Run cargo check with the Python bindings enabled:
just rust-check
Run the release-style GPU smoke end to end with:
just gpu-smoke
Repository Layout
python/lance_cuvs- root loader package
backends/cuvs_26_02- cuVS
26.02source tree for the CUDA 12 backend package
- cuVS
backends/cuvs_26_02/src/backend.rs- Lance-facing orchestration
backends/cuvs_26_02/src/cuda.rs- CUDA / cuVS wrappers and tensor helpers
backends/cuvs_26_02/src/python.rs- PyO3 bindings
License
Apache License 2.0. See LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pylance_cuvs-0.1.0b2-py3-none-any.whl.
File metadata
- Download URL: pylance_cuvs-0.1.0b2-py3-none-any.whl
- Upload date:
- Size: 13.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
39d4bc3c81979497a9c559631526b357b5cb2606ac6ee0ba0e0a6986945b3528
|
|
| MD5 |
0b831619b1e8ecb960509cd11edbf940
|
|
| BLAKE2b-256 |
eb5a51e8293cc5f4409c2afe0eefe34096c065255931d963430b4fe1398b1442
|
Provenance
The following attestation bundles were made for pylance_cuvs-0.1.0b2-py3-none-any.whl:
Publisher:
python-release.yml on lance-format/lance-cuvs
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pylance_cuvs-0.1.0b2-py3-none-any.whl -
Subject digest:
39d4bc3c81979497a9c559631526b357b5cb2606ac6ee0ba0e0a6986945b3528 - Sigstore transparency entry: 1294658118
- Sigstore integration time:
-
Permalink:
lance-format/lance-cuvs@15342cad1b7b79b4763dc5dd8c5441a8e6d28d75 -
Branch / Tag:
refs/tags/v0.1.0b2 - Owner: https://github.com/lance-format
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-release.yml@15342cad1b7b79b4763dc5dd8c5441a8e6d28d75 -
Trigger Event:
push
-
Statement type: