116 Commits
Author SHA1 Message Date
Patrick Kidger 7a84b27da9 Bump version v0.2.23 2023-10-11 11:25:06 -07:00
Roma Knyaz 77c263c3de Allow only typeguard lower than 3.x.x version 2023-10-10 10:18:49 -07:00
Patrick Kidger 91a36aaee4 dataclasses now have fields checked, not __init__.
Previously, using the import hook with dataclasses resulted in the `__init__` method of the dataclass being checked.
This was undesirable when using `eqx.field(converter=...)`, as the annotation didn't necessarily reflect the argument type.
A typical example was
```python
class Foo(eqx.Module):
    x: jax.Array = eqx.field(converter=jnp.ndarray)

Foo(1)  # 1 is not an array! But this code is valid.
```

After this change, we instead monkey-patch our checks to happen at the end of the `__init__` of the dataclass -- after conversion has run.

Note that this requires https://github.com/patrick-kidger/equinox/pull/524. Otherwise, Equinox does conversion too late (in `_ModuleMeta.__call__`, after `__init__` has been run).
2023-10-09 21:58:14 -07:00
Roma Knyaz 513a54b048 Better handling of user-defined typechecker 2023-10-09 10:21:07 -07:00
Patrick Kidger 9c9635d4f3 Add Orbax to ecosystem list. 2023-10-06 15:51:22 +01:00
Patrick Kidger c3e7fd35a2 Update ecosystem links 2023-10-06 15:43:29 +01:00
Roma Knyaz ef102f40b4 Bump up pre-commit ruff and black versions 2023-10-02 13:43:36 -07:00
Roma Knyaz 4917c2e30f Fix flakiness of transitive import hook test 2023-10-02 09:03:06 -07:00
Patrick Kidger 17092ad8d8 Simplified the import hook tests 2023-09-27 15:37:56 -07:00
Patrick Kidger 75392d6330 Added missing license headers 2023-09-27 15:37:56 -07:00
Patrick Kidger 18b8e76d67 Be tolerant of faulty IPython installs. 2023-09-25 18:15:02 -07:00
Patrick Kidger 1e5229c20e Should be more robust to jax/numpy/tensorflow version changes 2023-09-25 11:07:36 -07:00
Patrick Kidger e05985df2b Document IPython extension and version nump v0.2.22 2023-09-20 11:33:19 -07:00
Roma Knyaz f454cb797c Make jaxtyping an IPython extension 2023-09-20 10:34:32 -07:00
Patrick Kidger d2785baced Better suppotr for incomplete JAX installations. Supersedes #105. 2023-09-14 20:13:06 -07:00
Patrick Kidger c80c1264d3 Error message now mentions both array type and shape requirements. Supersedes #107. 2023-09-14 20:09:48 -07:00
Patrick Kidger e308695293 Updated to support both new and old style JAX PRNG keys, as they are going to co-exist simultaneously. See https://github.com/google/jax/pull/17297 2023-09-14 20:00:46 -07:00
Patrick Kidger e347c480d5 Hash is now stable across python runtimes v0.2.21 2023-08-17 16:23:33 +01:00
Patrick Kidger 13e6870fb8 Compatibility with JAX changes to opaque dtypes 2023-07-26 09:33:32 -07:00
Patrick Kidger 4c90808401 jaxtyping no longer appears in tracebacks 2023-07-26 09:33:32 -07:00
Patrick Kidger 5a57456e15 document Levanter 2023-07-12 19:36:09 +01:00
Patrick Kidger a6ab6c0d28 Have PRNGKeyArray appear correctly in downstream documentation 2023-06-29 18:39:22 -07:00
Patrick Kidger 83be9e9d16 Fixed jaxtyping doc generation 2023-06-25 12:00:16 -07:00
Patrick Kidger d2aa9c1e8d Merge branch 'main' of https://github.com/google/jaxtyping 2023-06-14 10:42:32 -07:00
Patrick Kidger 926dc53856 Have PyTreeDef appear correctly in docs 2023-06-14 10:42:14 -07:00
Patrick Kidger edc34f14f8 Update ecosystem links. 2023-06-07 15:35:45 +01:00
Patrick Kidger 8fa15050bc Update ecosystem links. 2023-06-07 15:35:14 +01:00
Patrick Kidger 356f5b7f7b Build fixes v0.2.20 2023-06-01 11:06:02 -07:00
Patrick Kidger 1b9c9fab52 Bump to Py3.9 2023-06-01 10:56:00 -07:00
Patrick Kidger 066a5b058f Made modules private. 2023-06-01 10:56:00 -07:00
Patrick Kidger 319d54abcf Avoid __builtins__ getting added as a key 2023-06-01 10:56:00 -07:00
Patrick Kidger 6a64ef114e Now provides PyTreeDef, and can detect PyTrees via issubclass(x, PyTree) 2023-06-01 10:56:00 -07:00
Patrick Kidger 10e1852b37 Fix favicon 2023-05-12 11:57:06 -07:00
Patrick Kidger a19149d23d Fixed pytest hook v0.2.19 2023-05-11 09:08:09 -07:00
Patrick Kidger 0c596ff373 Fix for non-JAX installations. v0.2.18 2023-05-10 17:16:42 -07:00
Patrick Kidger 7934d2afed Static typing fixes v0.2.17 2023-05-10 16:35:45 -07:00
Patrick Kidger 849b15db3b Added better docs; added PRNGKeys. Packaging with pyproject.toml.
Also added support for matching dtypes using regexes, and for nesting e.g. Shaped[Float[Array, "dim1 dim2"], "dim3"].
v0.2.16
2023-05-10 15:27:25 -07:00
Patrick Kidger 46c7896c99 Transitive test now uses typeguard instead of beartype 2023-04-19 11:48:08 -07:00
Patrick Kidger c92b0d0ab1 Some improvements (#77)
* Various improvements.

- Added support for functions in symbolic dimensions, e.g. "min(foo,bar)", which were previously disallowed due to the presence of a comma. (#51)
- Added support for adding ignored names to dimensions, e.g. "cols=4". (#76)

* Now works with Python 3.10 A | B union types.
v0.2.15
2023-04-13 19:18:55 +01:00
Patrick Kidger 158b8b8f0c Now works with torch.compile? (#72) 2023-04-13 18:53:14 +01:00
Patrick Kidger 9b6df18b83 Update FAQ to mention ruff 2023-03-19 22:21:21 +00:00
Patrick Kidger f0b240df5f Switched to ruff 2023-03-15 22:36:24 -07:00
Patrick Kidger a4d27c7cc1 Fixed _Jaxtyped.__get__, e.g. swallowing abstractmethod decorations 2023-03-15 22:27:36 -07:00
Patrick Kidger ee46c57e53 Version bump v0.2.14 2023-03-05 20:26:01 -08:00
Patrick Kidger 38be24f9c8 beartype+inheritance fix. Bool[int, '...'] now correctly raises an error. 2023-03-05 20:09:49 -08:00
Patrick Kidger e718f00cc5 Fixed import hook hitting __pycache__ even when you change the choice of runtime type checker 2023-03-05 16:19:44 -08:00
Patrick Kidger c232eeaa89 Fixed pytest plugin with new import hook typechecker syntax 2023-03-05 12:19:14 -08:00
Patrick Kidger e03c1c329e We now have Float[np.ndarray, ...] <: np.ndarray. Added basic torch tests. (#68)
This required quite a lot of refactoring! JAX supports virtual subclass registration (its metaclass is ABCMeta) but NumPy does not, so we have to actually subclass `np.ndarray`.
Simple stuff like __base__ hacking fails due to deallocator conflicts.
2023-03-04 17:29:04 +00:00
Patrick Kidger fef81cf0a0 The import hook now supports BeartypeConf/BeartypeStrategy 2023-03-03 10:34:03 -08:00
Patrick Kidger bf241b4e27 We now have e.g. Float[Array, ""] <: Array. 2023-03-03 10:32:26 -08:00