Skip to main content

PyPI Docs CI

bixverse

A single cell suite for Python, with the numerics in Rust (bixverse-rs).

It works on the store, not in memory, so it scales past what fits in RAM. On top sit a minibatch loader and a barebone scVI that train straight off that store, and a separate wheel with GPU twins of the expensive methods.

Docs, API reference and 23 vignettes: https://gregorlueg.github.io/bixverse-rs/

Install

uv pip install bixverse                         # the suite
uv pip install "bixverse[embed,plots]"          # plus UMAP & co and matplotlib plots
uv pip install "bixverse[gpu]"                  # plus the GPU twins
uv pip install "bixverse[torch]"                # scVI on torch; also [mlx], [jax]
uv pip install "bixverse[sparse]"               # scipy, for the scipy_csr exports

Use

from pathlib import Path

import bixverse as bv
import bixverse.embed

sc = bv.io.load_mtx(
    Path("experiments/pbmc3k"),
    bv.io.get_cell_ranger_params(bv.io.download_pbmc3k()),
)

bv.pp.find_hvg(sc, hvg_no=2000)
bv.pp.calculate_pca(sc, no_pcs=30)
bv.graph.find_neighbours(sc)
bv.graph.find_clusters(sc, res=1.0, name="leiden_clusters")
bv.embed.umap(sc)

bv.pl.embedding_plot(sc, "umap", "leiden_clusters", discrete=True)
markers = bv.de.find_all_markers(sc, "leiden_clusters")

bv.io.save(sc)
sc = bv.io.load_existing("experiments/pbmc3k")

An experiment is a directory and SingleCells a handle on it. Counts sit in two compressed binary files, cell-major and gene-major, memory-mapped on read, so each method pulls what it needs from the right one. obs and var live in a DuckDB next to them and come back as polars frames. QC doesn't delete anything: sc.set_cells_to_keep() decides which cells every later step sees. Functions take the experiment first and write into it, and the cache tracks what has gone stale.

Need it in ScanPy? bv.io.save_h5ad(sc, "out.h5ad") (or save_zarr) streams the kept cells out of the store in batches, so the matrix never sits in memory whole. genes= takes indices or ids and writes only those, in that order.

Everything reports progress by default. verbose takes 0 (False) for silent, 1 (True) for progress and 2 for extra detail where the method has it. logging.getLogger("bixverse").setLevel(logging.WARNING) silences the Python log lines but not what Rust prints.

What's in it

Module Contents
bv.io h5ad, anndata Zarr, 10x h5, MTX and in-memory loaders, saving, h5ad, Zarr and Cell Ranger writers, store upgrades, archives, example data
bv.qc gene set proportions, MAD outlier calls, fixed thresholds
bv.pp HVGs, PCA, Pearson residuals and scTransform, MAGIC
bv.graph kNN (the ann-search-rs indices), neighbour graphs, Leiden and Louvain, fast clustering
bv.embed UMAP, t-SNE, PHATE, densMAP, den-SNE, ForceAtlas2 (embed extra)
bv.integrate fastMNN, Harmony v1 and v2, Seurat CCA and RPCA, BBKNN, kBET and friends
bv.doublets Scrublet, boosted doublet detection, scDblFinder, empty droplets, CellSweep
bv.de markers (Wilcoxon or logistic regression), pseudobulk with edgeR QL, NEBULA, Milo, MELD
bv.annotate scType, Symphony reference mapping, Seurat label transfer
bv.metacells SEACells, SuperCells, hdWGCNA-style and MetaCells2 meta cells
bv.traj, bv.trees Palantir, PAGA, gene trends; Bonsai cell trees
bv.pathways, bv.nmf module scores, AUCell, VISION, Hotspot, SCENIC, decoupler-style activities; consensus NMF
bv.mm ADT counts, DSB and CLR, WNN
bv.atac ATAC peaks or tiles from 10x h5 or fragments, fragment QC, AMULET, peak calling, TF-IDF, LSI, rLSI, gene activity
bv.lr, bv.dialogue CellPhoneDB, NicheNet-style ligand-receptor; DIALOGUE
bv.pl matplotlib plots (plots extra) and the extract_* frames behind them
bv.pipeline chained steps with >>, per-group pipelines
bv.params every parameter set as a frozen dataclass

SingleCellsSubset handles sub-clustering, MetaCells and SingleCellsMultiModal go through the same functions.

GPU

bixverse-gpu is its own wheel, on wgpu. Each module mirrors its CPU namesake, takes the same objects and writes the same cache slots (bar Harmony and fastMNN, which write harmony_gpu and mnn_gpu), so a pipeline swaps one import for the other:

import bixverse_gpu as bvg

bvg.pp.calculate_pca(sc, 30)
bvg.graph.find_neighbours(sc)

bvg.gpu_available() probes for an adapter. Without one the twins raise bixverse.BixverseError.

MLX on Apple Silicon (experimental)

PCA, the kNN, fast clustering, Harmony and SEACells can also run on MLX via mlx-c instead of wgpu. The PyPI wheel does not carry it, so build both wheels from a checkout with mlx-c installed:

brew install mlx-c                 # or point MLX_C_PREFIX at an install
cd bixverse-rs/python
uv sync --group dev
uv run --no-sync maturin develop --release
cd gpu && uv run --no-sync maturin develop --release --features mlx

Then pass backend="mlx"; the default stays "wgpu":

bvg.mlx_available()  # True in this build
bvg.pp.calculate_pca(sc, 30, backend="mlx")
bvg.graph.find_neighbours(sc, backend="mlx")

MLX runs in f32. backend="mlx" on a build without it raises bixverse.BixverseError; --features mlx without mlx-c fails the build. After a brew upgrade mlx-c, rebuild.

Loader and scVI

CellLoader streams shuffled minibatches off the cell-major store. A feeder thread decodes ahead of your training step with the GIL released, and nothing gets materialised in memory.

reader = bv.CellReader(str(sc.cells_path))
loader = bv.CellLoader(reader, batch_size=256, layer="norm", seed=42)

for batch in loader:
    x = batch.scipy_csr()  # (256, n_genes) CSR

Pass an index array for a train / validation split and genes= to subset or reorder the columns. cell_ids on a batch joins per-cell covariates back on after the shuffle. Batches are sparse by default and you want that: a dense batch pays a zero-fill and a scatter over batch_size * n_genes floats, however few counts it holds. A few things to watch:

  • Cell-major stores only. A gene-major file raises on construction.
  • Ctrl-C can't interrupt a batch mid-decode, because the GIL is released while the feeder works.
  • The reader hints random access: right for a shuffled loader, wrong for a sequential full scan.

bixverse.nn trains scVI off the same store on torch, MLX or JAX, with scvi-tools 1.5.1's defaults, and a trained scvi-tools module loads into it and reproduces its loss.

import bixverse.nn as bvnn

fit = bvnn.train_scvi(reader, cells, hvg, batch, backend="torch")
latent = bvnn.scvi_latent(fit, reader, cells, batch)

The docs have the validation against scvi-tools.

Agent skill

The wheel ships an Agent Skill that teaches coding agents (Claude Code, Codex) the bixverse API. Install it from the project's environment, so it matches the bixverse version the project uses:

uv run bixverse skill install --project                # ./.claude/skills
uv run bixverse skill install --project --agent codex  # ./.agents/skills
uv run bixverse skill status                           # installs and versions

Drop --project to install for your user instead (~/.claude/skills, ~/.agents/skills). From Python: bv.install_agent_skill(). Each install is stamped with the package version, and import bixverse warns when an installed copy is outdated; --force updates it.

Vignettes

23 notebooks. Start with "Thinking the bixverse way" and "Analysing PBMCs". Each is a jupytext .py in docs/vignettes/ with its executed .ipynb next to it, and the data sets download themselves on first use.

uv sync --group dev --group vignettes
uv run python dev/vignettes.py execute                   # all of them
uv run python dev/vignettes.py execute pbmc_single_cell  # or by name

Development

uv sync --group dev
uv run maturin develop --release
uv run pytest tests -q

tests/test_r_interop.py checks that a store written by R opens in Python and the reverse; it skips without Rscript and the bixverse R package. The GPU wheel builds from gpu/.

Metadata

Release files for bixverse 0.4.1

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 bixverse 0.4.1
File Actions
bixverse-0.4.1-cp311-abi3-manylinux_2_28_aarch64.whl CPython 3.11 abi3 Linux glibc 2.28+ ARM64 Details for bixverse-0.4.1-cp311-abi3-manylinux_2_28_aarch64.whl
bixverse-0.4.1-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.11 abi3 Linux glibc 2.17+ x86-64 Details for bixverse-0.4.1-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
bixverse-0.4.1-cp311-abi3-macosx_11_0_arm64.whl CPython 3.11 abi3 macOS 11.0+ ARM64 Details for bixverse-0.4.1-cp311-abi3-macosx_11_0_arm64.whl
bixverse-0.4.1-cp311-abi3-macosx_10_12_x86_64.whl CPython 3.11 abi3 macOS 10.12+ x86-64 Details for bixverse-0.4.1-cp311-abi3-macosx_10_12_x86_64.whl

Total release size: 51.6 MB

Release files / bixverse-0.4.1-cp311-abi3-manylinux_2_28_aarch64.whl

Download URL bixverse-0.4.1-cp311-abi3-manylinux_2_28_aarch64.whl
Size 12.5 MB
Tags CPython 3.11 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
ec834b09871420d339255da2c1f46964d987704b77f143114cc5791d4f893099
BLAKE2b-256 checksum
How to use checksums
4649b84820f3fa7641236a24505e0e4032c4977d4efd2e066ad1c7a39d73678d
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 Dec 1, 2026.

Transparency log

Release files / bixverse-0.4.1-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL bixverse-0.4.1-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 14.0 MB
Tags CPython 3.11 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
78f326ec2dfa0b03fc4c21404f86bc87496b249e55560f9c1c93268cfaaa9115
BLAKE2b-256 checksum
How to use checksums
cc79547ee3327752002e5ca733e7561813e364381ec2d897e2fcd1ffeb11bba8
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 Dec 1, 2026.

Transparency log

Release files / bixverse-0.4.1-cp311-abi3-macosx_11_0_arm64.whl

Download URL bixverse-0.4.1-cp311-abi3-macosx_11_0_arm64.whl
Size 11.9 MB
Tags CPython 3.11 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
0bd497c80e05f7e07bf4141e1a401fd1108c107eb9b046c27169166a6f2076b0
BLAKE2b-256 checksum
How to use checksums
1146ce7940b8b428a14ee486a35cd8d29c36d5b789e55ff79eb5c42bdff08234
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 Dec 1, 2026.

Transparency log

Release files / bixverse-0.4.1-cp311-abi3-macosx_10_12_x86_64.whl

Download URL bixverse-0.4.1-cp311-abi3-macosx_10_12_x86_64.whl
Size 13.2 MB
Tags CPython 3.11 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
ad1b3228cda31d599ee5fd18f115e20872badff5bc3b3b4b66796ae6a9323ac3
BLAKE2b-256 checksum
How to use checksums
e8239a65f3bc49ce53b270b1f8d9ab46fb59b554e6d81a309a94bdef69edb71b
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 Dec 1, 2026.

Transparency log

Security for bixverse 0.4.1

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 4 files in this release have been uploaded with provenance metadata.

Select from 4 files

Attestation for bixverse-0.4.1-cp311-abi3-manylinux_2_28_aarch64.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 Dec 1, 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