Skip to content
API REFERENCEUsage guides →

Python API reference ​

Start with the object that owns your result: a matrix view, a Tensor batch, or a leased NumPy batch. The module pages explain parameters, returns and ownership; their declaration sections come from current Python source and the native type stub. Use the guides for complete programs and expected output.

Find your entry point

Browse by responsibility ​

AreaMain interfacesReference
Matrix storage and file toolsStore, File, Writer, CSR, read/write/compress, io CPK toolsStorage
Training Tensor batchesScDataset, corpus Accesses, ScDataLoaderTraining
Native NumPy loadingDataSource, OutputSchema, LoaderConfig, LoaderLoader
Sample sequencesNative Accesses and AccessFnAccess functions
Output memory and executionRingLayout, Ring, Batch, Consumer, RunRings and lifecycle
Cache planningPlanOptions, Plan, PageTrace, CostModelPlanning
Native row processingProcessFn, OutputLayout, model presets, compilerProcess functions
One-host shared loadingSharedRing, DistributedLoader, DistributedRunDistributed
Diagnostics and calibrationRunStats, MemoryEstimate, profile reports, costsStatistics
Chunk and record codecsscans functions, metadata, tables, reusable encoder/decoderCodecs
Annotated matricesread_h5, write_h5cp, write_h5ad, open_matrix, AnnDataAnnData

Imports and dependencies ​

The distribution and import name are both pycellpack. Common storage, training, planning and loading classes are re-exported at the root. Advanced ring/statistics interfaces live under pycellpack.loader; codecs live under pycellpack.cellpack.scans. The compiled _cellpack module is private.

Importing the root does not load SciPy, AnnData, h5py, pandas, PyTorch or Numba. Install the optional integration before using it. Torch is installed separately. See installation.

Conventions ​

Unless noted, counts are integers and byte sizes are bytes. Store selections are orthogonal and retain axes. Output IDs define column order; supply gene identity explicitly rather than relying on names or matching column positions.

NameImportIdentity space
Corpus sample orderfrom pycellpack import AccessesDataset ID and row within the dataset's Store view
Native access sequencefrom pycellpack.loader import AccessesGlobal cell ID assigned by DataSource

These two Accesses types serve different layers. Use corpus accesses with ScDataLoader and native accesses with Loader.

Native validation uses ValueError (and Python input type errors use TypeError), I/O uses OSError, and worker/cancellation/busy-state failures use RuntimeError. Async execution errors can arise while iterating or joining. Callback build errors have the process-function exception classes.

For NumPy batch retention, read rings and lifecycle before starting a long run. For Tensor transfer and application integration, continue with the training programs.