Skip to main content

pipnn

Fast, graph-based approximate-nearest-neighbor indexing for building the k-NN graph in single-cell / scanpy workflows — a Rust implementation (with PyO3 bindings) of the PiPNN method. It plugs into scanpy as a drop-in sc.pp.neighbors backend and also exposes a small standalone API. It builds the graph quickly at recall close to exact, and scales to tens of millions of cells.

Independent implementation of the PiPNN algorithm. Please cite the paper: Tobias Rubel, Richard Wen, Laxman Dhulipala, Lars Gottesbüren, Rajesh Jayaram, Jakub Łącki. PiPNN: Ultra-Scalable Graph-Based Nearest Neighbor Indexing. arXiv:2602.21247

Install

uv pip install pipnn      # or: pip install pipnn

Prebuilt wheels for Linux (x86_64, aarch64), macOS (arm64, x86_64), and Windows (x86_64); Python 3.9+. No Rust toolchain needed to install.

Quickstart

As a scanpy backend (drop-in for the default neighbor step):

import scanpy as sc
from pipnn import PiPNNTransformer

sc.pp.neighbors(adata, n_neighbors=15, use_rep="X_pca",
                transformer=PiPNNTransformer())
# then sc.tl.umap / sc.tl.leiden as usual

Standalone (just the k-NN graph):

import numpy as np
from pipnn import self_knn_graph

X = np.random.default_rng(0).normal(size=(100_000, 50)).astype("float32")
indices, distances = self_knn_graph(X, n_neighbors=15)
# indices, distances: shape (n, k+1), self edge first, sorted by distance

What it does

  • Produces the exact-distance k-NN graph scanpy expects — a scipy CSR of shape (n, n) with k+1 entries per row, the self edge first.
  • euclidean (default, matches scanpy on PCA space) and cosine metrics.
  • Parallel Rust build; deterministic given a fixed random_state.
  • Optional comparison backends under pipnn.contrib behind the same transformer API: a native HnswTransformer, FaissTransformer (pip install pipnn[faiss]), and GlassTransformer (pyglass).

Benchmarks & source

Full benchmarks — SIFT, and the Tahoe-100M single-cell atlas from 1M to 10M cells (build time, recall, and peak memory vs FAISS, pyglass, and pynndescent) — plus development notes and the comparison harness, are in the repository:

https://github.com/iandriver/pipnn-scanpy

MIT licensed.

Metadata

Release files for pipnn 0.1.0

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

Source distribution (sdist)

Source distribution for pipnn 0.1.0
File Size Uploaded
pipnn-0.1.0.tar.gz 1.4 MB Details

Built distributions (wheels)

Table of built distributions (wheels) for pipnn 0.1.0
File
pipnn-0.1.0-cp39-abi3-win_amd64.whl CPython 3.9 abi3 Windows x86-64 Details
pipnn-0.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.9 abi3 Linux glibc 2.17+ x86-64 Details
pipnn-0.1.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.9 abi3 Linux glibc 2.17+ ARM64 Details
pipnn-0.1.0-cp39-abi3-macosx_11_0_arm64.whl CPython 3.9 abi3 macOS 11.0+ ARM64 Details
pipnn-0.1.0-cp39-abi3-macosx_10_12_x86_64.whl CPython 3.9 abi3 macOS 10.12+ x86-64 Details

Total release size: 3.8 MB

Release files / pipnn-0.1.0.tar.gz

Download URL pipnn-0.1.0.tar.gz
Size 1.4 MB
Tags Source
SHA-256 checksum
How to use checksums
ab3f3e2377f657aa156e7f43b75c02d00666c7d27d14138ebc1609e40351b83a
BLAKE2b-256 checksum
How to use checksums
983b434e5f1fcf2bced6776b74bbfaa13ae540ddbab1d588cc54f5320527662d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.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 Jul 28, 2026.

Transparency log

Release files / pipnn-0.1.0-cp39-abi3-win_amd64.whl

Download URL pipnn-0.1.0-cp39-abi3-win_amd64.whl
Size 385.4 kB
Tags CPython 3.9 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
4ad18c4295641773a1b1271441719f855cd777e6d6347385f4bb1710a09ae950
BLAKE2b-256 checksum
How to use checksums
4ddee401053a8bef0de744aaf126da8c66d12b1aaafc7a1677b268459ead9bf9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.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 Jul 28, 2026.

Transparency log

Release files / pipnn-0.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL pipnn-0.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 521.3 kB
Tags CPython 3.9 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
2e12e5e14d41218073d928b35b4849513e9be5e2cc8adf465a05b186e33bfb6f
BLAKE2b-256 checksum
How to use checksums
953c4d0edbb20994be8bf4774784567dd91d7986a896a064e6ce8195bd9c95ca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.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 Jul 28, 2026.

Transparency log

Release files / pipnn-0.1.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL pipnn-0.1.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 496.7 kB
Tags CPython 3.9 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
9811923d5d0bfc3dd958ace0a0b54eaa0d6d5789472b7bb346dbfd0f42dcf818
BLAKE2b-256 checksum
How to use checksums
64a14415452db166065ba2318700f72697dfc43ed2be72910bd512d1a01e5fdf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.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 Jul 28, 2026.

Transparency log

Release files / pipnn-0.1.0-cp39-abi3-macosx_11_0_arm64.whl

Download URL pipnn-0.1.0-cp39-abi3-macosx_11_0_arm64.whl
Size 463.8 kB
Tags CPython 3.9 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
1413ae0dd260f3bcad08e3c802b66c2a75c9408012ac0c9eb1df8119712a7a89
BLAKE2b-256 checksum
How to use checksums
0c16ce0852e7547467dc7b01c4ad6163b99da087a2bf6ef64865cd49e5ff1c8c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.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 Jul 28, 2026.

Transparency log

Release files / pipnn-0.1.0-cp39-abi3-macosx_10_12_x86_64.whl

Download URL pipnn-0.1.0-cp39-abi3-macosx_10_12_x86_64.whl
Size 480.5 kB
Tags CPython 3.9 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
b27b599de3e9ba69ff9e72e1235e7def2c86e25c222c70f077cdda7864131906
BLAKE2b-256 checksum
How to use checksums
30a7af040b38f6d2ccf2a75b800272202509e1670ddd7526e1fda2550a7030ae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.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 Jul 28, 2026.

Transparency log

Release history Release notifications | RSS feed

0.1.1

6 release files

This release

0.1.0 This release

6 release files

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