6 Commits
Author SHA1 Message Date
Patrick Kidger 125bc89ee9 Added environment config flags.
These flags are `JAXTYPING_DISABLE` and `JAXTYPING_REMOVE_TYPECHECKER_STACK`.

In addition, have now added warnings when using old-style double-decorator syntax, which also serves to guard against the easy mistake of
```python
@jaxtyped(typechecker)
def foo(...)
```
which actually decorates the `typechecker`, not `foo`.
2023-12-05 19:06:00 -08:00
Patrick Kidger 12d540794f Pretty error messages: fixes #6.
Phew, this ended up being a pretty complicated change!
The basic summary is that we now support the syntax
```
@jaxtyped(typechecker=typechecker)
def f(...): ...
```
and when using this, we now get pretty error messages about what went
wrong.

(
The old syntax, i.e.
```
@jaxtyped
@typechecker
def f(...): ...
```
is still supported, but doesn't give much information.
)

The internals of this do quite a lot of magic! In particular we
dynamically create quite a lot of functions and test the provided
arguments against their signatures. The overhead should still be
minimal under `jax.jit`, though.
(TODO: what's the overhead like in non-jit situations, e.g. PyTorch?
I've tried to minimise the overhead throughout just to be sure, but
perhaps PyTorch users should stick to the old syntax?)
2023-11-27 09:50:02 -08:00
Roma Knyaz 513a54b048 Better handling of user-defined typechecker 2023-10-09 10:21:07 -07:00
Patrick Kidger e162e1281a Made missing beartype result in test skips rather than tests not running 2022-07-12 10:07:42 +01:00
Patrick Kidger 81238e38e8 Update tests to make beartype optional 2022-07-11 19:27:16 +01:00
Patrick Kidger 0800e5fa38 renamed tests->test so release workflow works 2022-07-11 13:06:54 +01:00