Skip to content

Features

Shapix layers several pieces together:

  • a shape language built from Python objects such as N, Scalar, and Value("size")
  • backend-specific array aliases such as F32, BF16, and DT64
  • input-contract aliases such as F32Like[...] and U8ScalarLike
  • memo helpers for explicit scope control when plain @beartype is not enough
  • a static typing surface exercised by pyright, mypy, and ty

Guides

  • Dimensions — Named, fixed, variadic, broadcastable, anonymous, and symbolic dimensions.
  • Static Typing — How the public annotation surface maps onto pyright, mypy, and ty, plus the runtime-only patterns that still need targeted workarounds.
  • Array Types — Dtype-checked array aliases for NumPy, JAX, PyTorch, CuPy, and custom array classes.
  • Like Types — Input validation types that accept scalars, arrays, or nested sequences, plus range-validated ScalarLike aliases.
  • Tree Annotations — Validate all leaves and enforce structure consistency in nested containers.
  • Decorator & Memo@shapix.check, check_context, async behavior, and when explicit memo scope is worth it.
  • Import Hook — Package-wide instrumentation with beartype.claw.