Skip to main content
Pre-release

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

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:

  1. Train an IVF_PQ model with cuVS.
  2. Build a partition-local artifact from a Lance dataset.
  3. 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 6112a34bfe38618f07c099217dc3d89fd39ca6bb or 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-cuvs
  • pylance-cuvs-cu12
  • libcuvs-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_partitions
  • num_sub_vectors
  • num_bits
  • metric_type
  • ivf_centroids() -> pyarrow.FixedSizeListArray
  • pq_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_uri
  • files

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.02 source tree for the CUDA 12 backend package
  • 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.

Metadata

Release files for pylance-cuvs 0.1.0b2

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

Built distribution (wheel)

Table of built distributions (wheels) for pylance-cuvs 0.1.0b2
File Interpreter ABI Platform
pylance_cuvs-0.1.0b2-py3-none-any.whl Python 3 none any Details

Release files / pylance_cuvs-0.1.0b2-py3-none-any.whl

Download URL pylance_cuvs-0.1.0b2-py3-none-any.whl
Size 13.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
39d4bc3c81979497a9c559631526b357b5cb2606ac6ee0ba0e0a6986945b3528
BLAKE2b-256 checksum
How to use checksums
eb5a51e8293cc5f4409c2afe0eefe34096c065255931d963430b4fe1398b1442
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 Apr 14, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.0b2 This release

1 release file

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