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-Ccan'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.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
| File | Actions Reset | |||
|---|---|---|---|---|
| bixverse-0.4.0-cp311-abi3-manylinux_2_28_aarch64.whl | CPython 3.11 | abi3 | Linux glibc 2.28+ ARM64 | Details for bixverse-0.4.0-cp311-abi3-manylinux_2_28_aarch64.whl |
| bixverse-0.4.0-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.0-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl |
| bixverse-0.4.0-cp311-abi3-macosx_11_0_arm64.whl | CPython 3.11 | abi3 | macOS 11.0+ ARM64 | Details for bixverse-0.4.0-cp311-abi3-macosx_11_0_arm64.whl |
| bixverse-0.4.0-cp311-abi3-macosx_10_12_x86_64.whl | CPython 3.11 | abi3 | macOS 10.12+ x86-64 | Details for bixverse-0.4.0-cp311-abi3-macosx_10_12_x86_64.whl |
Total release size: 51.6 MB
Release files / bixverse-0.4.0-cp311-abi3-manylinux_2_28_aarch64.whl
| Download URL | bixverse-0.4.0-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 |
00e3081d18743fa273719a19bfd6f117d3dac1e418f38221fab4fbe96ae6da1f
|
|
BLAKE2b-256 checksum How to use checksums |
21d4bf5910bd00194ca9b3e8afdaec7542fcc5502da229d46663a3830d2ecef1
|
| 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 24, 2026.
Transparency logRelease files / bixverse-0.4.0-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
| Download URL | bixverse-0.4.0-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 |
62e5650c2607c33e1c95404dd597ffc3d02d27404b9e30167c1a697b45f937cd
|
|
BLAKE2b-256 checksum How to use checksums |
6105117f815771c1ce12cbaeeb67e9d83c6907cdcf1cf9d517a58f5e3d4776b3
|
| 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 24, 2026.
Transparency logRelease files / bixverse-0.4.0-cp311-abi3-macosx_11_0_arm64.whl
| Download URL | bixverse-0.4.0-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 |
4debaedcd84a99e8a91f59572cdcd5e50aee8f13575d08e2c47941a8cfd7b3c3
|
|
BLAKE2b-256 checksum How to use checksums |
716631d3eb6f315cec69c28d1b85847df5b6a80db52757111c53f06dc2faee79
|
| 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 24, 2026.
Transparency logRelease files / bixverse-0.4.0-cp311-abi3-macosx_10_12_x86_64.whl
| Download URL | bixverse-0.4.0-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 |
ad607f9e339858f79a446085c3d7b7f2be5cd351f0ca55ab5424b7a4698ebfee
|
|
BLAKE2b-256 checksum How to use checksums |
b1334cc5e7c8faccd80ff1355e4f5a8160716f8a1006c44c7fb81434273270e3
|
| 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 24, 2026.
Transparency logSecurity for bixverse 0.4.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 4 files in this release have been uploaded with provenance metadata.
Attestation for bixverse-0.4.0-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 Nov 24, 2026.
Transparency logA 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.