Metadata-Version: 2.4
Name: jax-shapeguard
Version: 0.3.0
Summary: Runtime shape contracts and diagnostics for NumPy and JAX
Project-URL: Homepage, https://github.com/jayendra13/jax-shape-guard
Project-URL: Repository, https://github.com/jayendra13/jax-shape-guard
Author-email: Jayendra Parmar <jayendra0parmar@gmail.com>
License-Expression: MIT
License-File: LICENSE
Keywords: debugging,jax,ml,numpy,shapes,validation
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Typing :: Typed
Requires-Python: >=3.10
Provides-Extra: jax
Requires-Dist: jax>=0.4; extra == 'jax'
Requires-Dist: jaxlib>=0.4; extra == 'jax'
Description-Content-Type: text/markdown

# ShapeGuard

[![Tests](https://github.com/jayendra13/jax-shape-guard/actions/workflows/test.yml/badge.svg)](https://github.com/jayendra13/jax-shape-guard/actions/workflows/test.yml)
[![Lint](https://github.com/jayendra13/jax-shape-guard/actions/workflows/lint.yml/badge.svg)](https://github.com/jayendra13/jax-shape-guard/actions/workflows/lint.yml)
[![PyPI version](https://img.shields.io/pypi/v/shapeguard.svg)](https://pypi.org/project/shapeguard/)
[![Python versions](https://img.shields.io/pypi/pyversions/shapeguard.svg)](https://pypi.org/project/shapeguard/)
[![License](https://img.shields.io/github/license/jayendra13/jax-shape-guard.svg)](https://github.com/jayendra13/jax-shape-guard/blob/main/LICENSE)

Runtime shape contracts and diagnostics for NumPy and JAX.

## Installation

```bash
pip install shapeguard
```

## Quick Start

```python
from shapeguard import Dim, expects

n, m, k = Dim("n"), Dim("m"), Dim("k")

@expects(a=(n, m), b=(m, k))
def matmul(a, b):
    return a @ b
```

When shapes don't match, you get clear errors:

```
ShapeGuardError:
  function: matmul
  argument: b
  expected: (m, k)
  actual:   (5, 7)
  reason:   dimension 'm' bound to 4 from a.shape[1], but got 5 from b.shape[0]
```

## License

MIT
