Skip to main content

PyPI Docs CI

manifolds-rs

Dimensionality reduction for single-cell and computational biology. The Rust crate does the work; this is a scikit-learn shaped layer over it.

Ten algorithms on the CPU, five of them with GPU variants where the neighbour search and the optimiser (UMAP's Adam, t-SNE's three-kernel FFT) move to the device. Scanpy-style mf.umap(adata) and mf.tsne(adata) for AnnData. No CUDA runtime to install: the GPU backend is wgpu, so it runs on Metal, Vulkan or DX12 and ships in the ordinary wheel.

Documentation: https://gregorlueg.github.io/manifolds-rs/

This package versions separately from the Rust crate. Changes here are in python/CHANGELOG.md; the crate's are in CHANGELOG.md.

Install

uv pip install manifolds-rs

Wheels are built for Linux x86_64 and macOS on both architectures, against Python 3.10 and up.

Thirty seconds

import manifolds_rs as mf

X, labels = mf.datasets.clustered(20_000, dim=50, n_clusters=12)

embedding = mf.UMAP(n_neighbors=15, min_dist=0.1).fit_transform(X)

Every estimator takes its parameters in the constructor, its data in fit, and hands back an (n_samples, n_components) array. get_params and set_params are there, so clone and Pipeline work without scikit-learn being an install requirement.

What's here

Class What it is for
UMAP The default choice. Local structure, decent global structure from the spectral init.
DensMAP UMAP with relative density preserved, so a dense region stays dense.
TSNE Local structure above all else. Barnes-Hut, the faster quick-and-dirty approx="qd", or FFT-interpolated approx="fft" / "fft_3k" for large N. 2-D only.
DensNE t-SNE with the same density correction.
DREAMS t-SNE pulled towards a global reference (PCA, or any layout you pass), so the clusters keep a sensible arrangement.
PHATE Continuous structure. Trajectories and branch points survive this.
PaCMAP Global structure without leaning on a spectral init. Three pair types.
LocalMAP PaCMAP with a locally adjusted final phase, so clusters PaCMAP leaves touching come apart.
DiffusionMaps The spectral embedding PHATE is built on.
ForceAtlas2 Gephi's force-directed layout on the kNN graph, as in scanpy's draw_graph. 2-D only.
NCVis Noise-contrastive layout on the unweighted kNN graph from a PCA start. t-SNE-like clusters, cheap, keeps the PCA arrangement. Hogwild, so reproducible only on one thread.
UMAPGpu, DensMAPGpu, TSNEGpu, DREAMSGpu, PHATEGpu The same, with the neighbour search on the device. TSNEGpu(approx="fft_3k_gpu") runs the optimiser there too, PHATEGpu the spectral landmark selection.

AnnData

With uv pip install 'manifolds-rs[anndata]', mf.umap and mf.tsne drop in for sc.tl.umap and sc.tl.tsne: same slots, so sc.pl.umap just works.

import scanpy as sc
import manifolds_rs as mf

sc.pp.pca(adata)
sc.pp.neighbors(adata)
mf.umap(adata)  # obsm["X_umap"], uns["umap"]
mf.tsne(adata)  # obsm["X_tsne"], uns["tsne"]
sc.pl.umap(adata, color="leiden")

device="gpu" switches to the GPU estimators. On 25,000 cells on an M1 Max, mf.umap ran in 1.5s against 10.6s for sc.tl.umap, and mf.tsne in 9.7s (4.9s with device="gpu", approx="fft_3k_gpu") against 47.2s for a 10-thread sc.tl.tsne. The AnnData page has the full table, cluster separation included, and the caveats.

Parameters

The knobs people actually turn are ordinary constructor arguments. The rest live in frozen dataclasses, one per group, and anything you leave alone keeps the crate's default:

mf.UMAP(
    n_neighbors=30,
    ann="hnsw",
    nn_params=mf.NeighbourParams(m=32, ef_search=200),
    optim_params=mf.UmapOptim(gamma=1.5, neg_sample_rate=10),
)

Every parameter has exactly one home. If it is a constructor argument it is not in the group, so there is never a question of which wins.

Reusing the neighbour graph

Running several embeddings over the same data? Build the graph once. On anything large the search is most of the runtime.

ind, dist = mf.knn_graph(X, k=60, ann="hnsw")

a = mf.UMAP().fit_transform(X, knn_indices=ind, knn_distances=dist)
b = mf.PaCMAP().fit_transform(X, knn_indices=ind, knn_distances=dist)

No transform

None of these projects new points, so there is no transform. That is the crate's position rather than a gap in the bindings: embedding new data means refitting on the combined set, which moves the existing coordinates too. Anyone telling you otherwise is doing something to the new points that is not the same operation the old ones went through.

Precision

float32 in, float32 out; float64 in, float64 out. Anything else is promoted to float64 rather than narrowed. The neighbour search runs in float32 on every backend bar "exhaustive", while PCA initialisation and the randomised SVDs always run in float64. The GPU estimators cast to float32 at any size, and the "fft_3k_mlx" t-SNE optimiser runs in float32 on the device.

What is not in the wheel

The MLX backends for Apple Silicon. They link mlx-c dynamically, so they need a source build: brew install mlx-c, then maturin develop --release --features mlx. See the GPU page of the docs.

Parametric UMAP is in the crate but not yet bound.

Metadata

Release files for manifolds-rs 0.7.0

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

Built distributions (wheels)

Table of built distributions (wheels) for manifolds-rs 0.7.0
File Interpreter ABI Platform Actions
manifolds_rs-0.7.0-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.10 abi3 Linux glibc 2.17+ x86-64 Details for manifolds_rs-0.7.0-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
manifolds_rs-0.7.0-cp310-abi3-macosx_11_0_arm64.whl CPython 3.10 abi3 macOS 11.0+ ARM64 Details for manifolds_rs-0.7.0-cp310-abi3-macosx_11_0_arm64.whl
manifolds_rs-0.7.0-cp310-abi3-macosx_10_12_x86_64.whl CPython 3.10 abi3 macOS 10.12+ x86-64 Details for manifolds_rs-0.7.0-cp310-abi3-macosx_10_12_x86_64.whl

Total release size: 48.7 MB

Release files / manifolds_rs-0.7.0-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL manifolds_rs-0.7.0-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 17.4 MB
Tags CPython 3.10 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
d81143e2487607f6dc3eefa3a3eff4dd3a6d3bbe2653754eb1a276130009c7f0
BLAKE2b-256 checksum
How to use checksums
bd348b25ccb1d791630e69c972d8672c27d742179068e72cb6429aca8083bc34
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 17, 2026.

Transparency log

Release files / manifolds_rs-0.7.0-cp310-abi3-macosx_11_0_arm64.whl

Download URL manifolds_rs-0.7.0-cp310-abi3-macosx_11_0_arm64.whl
Size 15.0 MB
Tags CPython 3.10 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
f71bf5a7b815e40933ac136ad68ee5298cb0d739aed7e1b1e44dcd314207375d
BLAKE2b-256 checksum
How to use checksums
47880187c2b64f2e6ba058de42b2970730f28722c1ebe6057caa297e4a405668
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 17, 2026.

Transparency log

Release files / manifolds_rs-0.7.0-cp310-abi3-macosx_10_12_x86_64.whl

Download URL manifolds_rs-0.7.0-cp310-abi3-macosx_10_12_x86_64.whl
Size 16.3 MB
Tags CPython 3.10 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
bd58eeaa05a2628ac6f694741cf7f45140528db5dcc2137bed9fc225bc381eec
BLAKE2b-256 checksum
How to use checksums
4f74804586e6c90fc95c23e73874d15f8701ccde7b3dba1170a3c3d09dc69346
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 17, 2026.

Transparency log

Security for manifolds-rs 0.7.0

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.

Full provenance

All 3 files in this release have been uploaded with provenance metadata.

Select from 3 files

Attestation for manifolds_rs-0.7.0-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

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 Nov 17, 2026.

Transparency log

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.

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