Installation¶
Requirements¶
- Python >= 3.10
- beartype >= 0.23.0rc0, < 0.24, installed automatically with
bearshape
Install with pip¶
The distribution name and import package are both bearshape:
bearshape intentionally does not use extras such as bearshape[numpy].
Install bearshape and your backend packages explicitly.
Note
bearshape.jax, bearshape.torch, and bearshape.cupy require numpy
alongside the backend. The lightweight root import import bearshape does not.
Install with uv¶
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 bearshape.optree.Tree |
Import boundaries¶
The root package is designed to stay optional-dependency-safe:
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:
bearshape.numpyneedsnumpybearshape.jaxneedsjaxandnumpybearshape.torchneedstorchandnumpybearshape.cupyneedscupyandnumpybearshape.optreeneedsoptree
Verify installation¶
Then verify the backend you actually plan to use: