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.1

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.1
File Size Uploaded
pipnn-0.1.1.tar.gz 1.4 MB Details

Built distributions (wheels)

Table of built distributions (wheels) for pipnn 0.1.1
File
pipnn-0.1.1-cp39-abi3-win_amd64.whl CPython 3.9 abi3 Windows x86-64 Details
pipnn-0.1.1-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.1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.9 abi3 Linux glibc 2.17+ ARM64 Details
pipnn-0.1.1-cp39-abi3-macosx_11_0_arm64.whl CPython 3.9 abi3 macOS 11.0+ ARM64 Details
pipnn-0.1.1-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.1.tar.gz

Download URL pipnn-0.1.1.tar.gz
Size 1.4 MB
Tags Source
SHA-256 checksum
How to use checksums
93a16f64aa7177f0a6b8930a788c473302ae004df3699c3e76922ccf023edeed
BLAKE2b-256 checksum
How to use checksums
5c70c973185e55ec8e25425d24bbbf8fc18bca4c129678c0a37cf3c9898b4ba1
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 29, 2026.

Transparency log

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

Download URL pipnn-0.1.1-cp39-abi3-win_amd64.whl
Size 385.4 kB
Tags CPython 3.9 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
7dc6d0fbeff31a6f7912fc0b7f529ae4eb382aad6132573063270b5cf90b0d1d
BLAKE2b-256 checksum
How to use checksums
bb02af4a34c5bc1268108b0b714aae658738976b1a7cb1a631ef9fb24d165f0b
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 29, 2026.

Transparency log

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

Download URL pipnn-0.1.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 521.4 kB
Tags CPython 3.9 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
995b2d7a4d46bcf1e7510ac7ff99636d4e04de6f5003d0d7c537609b8e97623d
BLAKE2b-256 checksum
How to use checksums
32eb554441fe85f4af1a97a00a0e1e267c63ccc58a75ce1ee879e0f42ad7ba8c
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 29, 2026.

Transparency log

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

Download URL pipnn-0.1.1-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
5ff13b06ede0161cab163ffa08d173b39e74919f2303d0fe584ef0c8489ebf8f
BLAKE2b-256 checksum
How to use checksums
792c9659f4f5e0ce1c067162766ecc6b4c18b52f6741ff2533750d0e68190d96
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 29, 2026.

Transparency log

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

Download URL pipnn-0.1.1-cp39-abi3-macosx_11_0_arm64.whl
Size 463.9 kB
Tags CPython 3.9 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
652f4d7099cf90f8d372dd1c360fc7ed24cee11d0ca3fe7904f81ea26b1a6cfd
BLAKE2b-256 checksum
How to use checksums
21ff8391e1f56e4b3e1b46ab70ab2815529d4e9e252b6611d559d2c8387fee95
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 29, 2026.

Transparency log

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

Download URL pipnn-0.1.1-cp39-abi3-macosx_10_12_x86_64.whl
Size 480.7 kB
Tags CPython 3.9 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
e866162dfa991f1b87e3f681b95c99ba14e2a89d8e69016157368b0bc1e74c6a
BLAKE2b-256 checksum
How to use checksums
da4ebb664ba1e646e37a063065872ff1fc74e9f4dc9209c675ae75f98659f764
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 29, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.1 This release

6 release files

0.1.0

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