patrick-kidger / jaxtyping

Type annotations and runtime checking for shape and dtype of JAX/NumPy/PyTorch/etc. arrays. https://docs.kidger.site/jaxtyping/
Other
1.23k stars 63 forks source link

internal `_typeguard` not picked up by `install_import_hook` #274

Open phinate opened 2 days ago

phinate commented 2 days ago

Hi Patrick! With the recent shipping of typeguard in jaxtyping as of this recent commit, I'm getting ModuleNotFoundError: No module named 'typeguard' in the context of

with install_import_hook("...", "typeguard.typechecked"):
    ...

Am I doing things right here? If it was desired to pick up the internally shipped typeguard, then maybe doing some sort of check here to see if there's a typeguard version in the env already (and use jaxtyping._typeguard if not) would be useful.

What do you think?

patrick-kidger commented 1 day ago

This is working as intended! If you want to use typeguard then install it directly as you would normally, pretty much just like you would have done before.

The vendored version exists just to ease compatibility issues, it's not meant to be used in this way :)