Skip to main content

bixverse

Python bindings for bixverse-rs. The crate does the work: this is a thin layer that opens a bixverse binary sparse store and streams minibatches out of it fast enough to keep a GPU training loop fed.

The first consumer is scVI, which ships in bixverse.nn (torch or MLX) and trains straight off the store, shuffled, without ever materialising the experiment in memory. Decoding never leaves Rust, and the GIL is released while it happens.

Install

uv pip install bixverse            # numpy only
uv pip install "bixverse[sparse]"  # adds scipy, for Batch.scipy_csr
uv pip install "bixverse[torch]"   # scVI on torch
uv pip install "bixverse[mlx]"     # scVI on MLX, Apple Silicon

Use

import bixverse as bv

reader = bv.CellReader("counts.bin")
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 to iterate a subset, which is how a train/validation split gets expressed:

import numpy as np

rng = np.random.default_rng(0)
perm = rng.permutation(reader.total_cells)
train = bv.CellLoader(reader, perm[:180_000], batch_size=256)
val = bv.CellLoader(reader, perm[180_000:], batch_size=256, shuffle=False)

Each pass over a loader reshuffles and spawns its own feeder thread, so two concurrent passes don't share state. The seed is mixed with the epoch counter: same seed means the same sequence of epochs, not the same epoch twice.

Batches

A Batch is a NamedTuple of (raw, norm, indices, indptr, shape, cell_ids). The layer you didn't ask for is None. cell_ids is the store index of each row, which is how per-cell covariates get joined back on after the shuffle. CellLoader(genes=...) restricts and reorders the columns.

Field Sparse Dense
raw / norm CSR-ordered float32 (n_cells, n_genes) float32
indices / indptr uint32 CSR components None
shape (n_cells, n_genes) same

batch.values() returns the single requested layer, batch.scipy_csr() rebuilds a scipy.sparse.csr_matrix sharing the same buffers.

scVI

import bixverse.nn as bvnn

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

scvi-tools 1.5.1's defaults, NB or ZINB, and a trained scvi-tools module loads into it and reproduces its loss. See the docs for the validation against scvi-tools.

Sparse by default

sparse=True is the default and you want it. A dense batch pays a zero-fill and a scatter over batch_size * n_genes floats regardless of how few counts it actually holds. At droplet sparsity that's roughly twenty times the memory traffic for the same information, on the feeder thread, every batch. Build the dense tensor on the GPU instead if you need one.

Layers

"raw" gives the counts. "norm" gives log1p(count / library_size * target_size), computed at write time and stored as float16, so expect agreement with a recomputation to about three decimal places rather than to machine precision. "both" returns the two together over one sparsity pattern.

Caveats

  • Cell-major stores only. A gene-major file raises on construction.
  • Ctrl-C can't interrupt a batch mid-decode: the GIL is released while the feeder works, and Python signal handlers only run while it's held.
  • The store is memory-mapped and the reader hints random access, which is right for a shuffled loader and wrong for a sequential full scan.

Development

uv venv
uv pip install "maturin>=1.15,<2" numpy scipy pytest beartype
maturin develop --release
pytest tests -q

Metadata

Release files for bixverse 0.1.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.1.1
File Interpreter ABI Platform
bixverse-0.1.1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.10 abi3 Linux glibc 2.17+ x86-64 Details
bixverse-0.1.1-cp310-abi3-macosx_11_0_arm64.whl CPython 3.10 abi3 macOS 11.0+ ARM64 Details
bixverse-0.1.1-cp310-abi3-macosx_10_12_x86_64.whl CPython 3.10 abi3 macOS 10.12+ x86-64 Details

Total release size: 5.2 MB

Release files / bixverse-0.1.1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL bixverse-0.1.1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 2.0 MB
Tags CPython 3.10 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
880c69f6cd24fcd2a283c418ae3ff4ae88bb2ba2a236aee2aa1fbd2089c369aa
BLAKE2b-256 checksum
How to use checksums
571a0ed26ff1306eba6b995279ec4a75e8df9b769253a5deaec99fd13d4d9a2f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.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 Oct 19, 2026.

Transparency log

Release files / bixverse-0.1.1-cp310-abi3-macosx_11_0_arm64.whl

Download URL bixverse-0.1.1-cp310-abi3-macosx_11_0_arm64.whl
Size 1.5 MB
Tags CPython 3.10 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
e2db4b3ca03aa6acfb44df16eaf20700d57f008f72bb31ee73cb422d58f25010
BLAKE2b-256 checksum
How to use checksums
e47555f6552e3e51150c5a47b11be51711c1b1454fa000e9dabf45d923437bcf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.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 Oct 19, 2026.

Transparency log

Release files / bixverse-0.1.1-cp310-abi3-macosx_10_12_x86_64.whl

Download URL bixverse-0.1.1-cp310-abi3-macosx_10_12_x86_64.whl
Size 1.8 MB
Tags CPython 3.10 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
927352f4cf985e4b44de114fb8dc5ad6f096d09c1fd2791f1b531f5b76af4f9f
BLAKE2b-256 checksum
How to use checksums
f94662826065e2bb29e4a2bf7396412ec2db91d311b20fd07df0eaf4b250b386
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.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 Oct 19, 2026.

Transparency log

Security for bixverse 0.1.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 3 files in this release have been uploaded with provenance metadata.

Select from 3 files

Attestation for bixverse-0.1.1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_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 Oct 19, 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.

Release history Release notifications | RSS feed

This release

0.1.1 This release

3 release files Full provenance

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