Skip to content

Installation

Requirements

  • Python >= 3.10
  • beartype >= 0.20, installed automatically with shapix-rt

Install with pip

pip install shapix-rt

The distribution name is shapix-rt, where rt means runtime. The import path stays:

import shapix

Shapix intentionally does not use extras such as shapix-rt[numpy]. Install shapix-rt and your backend packages explicitly.

pip install shapix-rt numpy
pip install shapix-rt numpy torch
pip install shapix-rt numpy jax
pip install shapix-rt numpy cupy
pip install shapix-rt numpy optree  # or install jax and use shapix.jax.Tree

Note

shapix.jax, shapix.torch, and shapix.cupy require numpy alongside the backend. The lightweight root import import shapix does not.

Install with uv

uv add shapix-rt

Optional dependencies

Package Purpose
numpy NumPy array aliases, ScalarLike, and backend dtype helpers
torch PyTorch tensor aliases and Torch Like types
jax JAX array aliases, JAX Like types, and JAX Tree
cupy CuPy array aliases and CuPy Like types
optree Explicit OpTree backend via shapix.optree.Tree

Import boundaries

The root package is designed to stay optional-dependency-safe:

import shapix

print(shapix.__version__)
print(shapix.N, shapix.C)

That works even in a plain source checkout without installed package metadata. In that case __version__ falls back to a non-empty string such as 0+unknown.

Backend modules are stricter:

  • shapix.numpy needs numpy
  • shapix.jax needs jax and numpy
  • shapix.torch needs torch and numpy
  • shapix.cupy needs cupy and numpy
  • shapix.optree needs optree

Verify installation

import shapix
print(shapix.__version__)

Then verify the backend you actually plan to use:

from shapix import N, C
from shapix.numpy import F32