Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix typeguard upper bound #46

Merged
merged 1 commit into from
Jun 20, 2023

Conversation

MilesCranmer
Copy link
Contributor

The current package breaks on typeguard>=3 due to the following error:

  File "/.../test2.py", line 13, in <module>
    patch_typeguard()  # use before @typechecked
  File "/.../python3.10/site-packages/torchtyping/typechecker.py", line 271, in patch_typeguard
    class _CallMemo(typeguard._CallMemo):
  File "/.../python3.10/site-packages/typeguard/__init__.py", line 42, in __getattr__
    raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
AttributeError: module 'typeguard' has no attribute '_CallMemo'. Did you mean: 'CallMemo'?

So this just limits the typeguard install to <3 which fixes things. It looks like a few functions need to be rewritten on >=3 so this is a simple band-aid fix.

(I understand this package isn't actively maintained, but until patrick-kidger/jaxtyping#6 is closed, I find this package a bit more useful, even though you mention the patch_typeguard felt a bit hacky 😄)

@patrick-kidger patrick-kidger merged commit 1f3749c into patrick-kidger:master Jun 20, 2023
@patrick-kidger
Copy link
Owner

LGTM, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants