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

Allow only typeguard lower than 3.x.x version #124

Conversation

knyazer
Copy link
Contributor

@knyazer knyazer commented Oct 10, 2023

Hi Patrick,

I noticed that in pyproject.toml there is no constraint on the highest allowed version of typeguard, eventhough it looks like there should be. PEP 508 explains how does version notation work, and thus I just introduced this constraint.

@knyazer
Copy link
Contributor Author

knyazer commented Oct 10, 2023

I am not exactly sure what all the effects might be, but I think the main effect is reduced amount of wrong-typeguard-version problems when doing pip install jaxtyping, since now the typeguard of the correct version will be installed.

@patrick-kidger patrick-kidger merged commit 77c263c into patrick-kidger:main Oct 10, 2023
2 checks passed
@patrick-kidger
Copy link
Owner

LGTM! This is worthwhile, agreed.

@MaximilienLC
Copy link

MaximilienLC commented Oct 15, 2023

Hi y'all, typeguard < 3 dates back 2 years or so. Might be better to bound it to a more recent date to avoid conflicts. First example: pygls

jaxtyping 0.2.23 depends on typeguard<3 and >=2.13.3
pygls 1.1.1 depends on typeguard<4.0.0 and >=3.0.0

@patrick-kidger
Copy link
Owner

Unfortunately, typeguard v3 or v4 are known to have some bugs; these issues are triggered by jaxtyping in particular. There's some back-and-forth on the topic here: agronholm/typeguard#353

To be honest, my impression is that later versions of typeguard have started doing things that are unlikely to be broadly compatible with the ecosystem at large -- things like setting typing.TYPE_CHECKING=True, or re-parsing the AST of modules after they've been imported. Hence why we pin to an older version.

(As JAX's JIT compilation means that the overhead from runtime type-checking is unimportant, I'm starting to contemplate writing my own simple-and-slow-but-correct runtime type checker just to solve this issue.)

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.

None yet

3 participants