-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
How to use _typeshed.wsgi with typing.get_type_hints #11004
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
Comments
Fixes python#11004. I started out just documenting conventions with `@deprecated`, but found some other things in need of updates. - PEP 585 and 612 are now fully supported - Add several other PEPs that we fully support - Use updated links to PEPs - Split off a few sections from the long "Conventions" section - PEP 688 was accepted
@adaamz If you are trying to access the type hint at runtime you currently can't have any type checking only imports. You are importing PEP649 would partially remedy this by allowing partial evaluation of annotations, i.e. the If you don't actually care about verifying the types as much and want to do something less powerful to distinguish between a couple of well defined cases, you can look at Another way to deal with this would be to use the |
Hello @Daverball, Annotations might be the solution - tbh because |
Yeah until PEP649 becomes a thing (Python 3.13 at the earliest, although maybe they'll allow accessing the feature in earlier versions of Python via You pretty much have to write your own logic based on |
This was apparently closed accidentally with a typo in a merge commit message. |
Uh oh!
There was an error while loading. Please reload this page.
Hello there,
is there a way to get to work combination of
_typeshed.wsgi
andtyping.get_type_hints
in runtime?In flask codebase there is something like
https://github.com/pallets/flask/blob/3.0.0/src/flask/typing.py
and in my application I use something like
which ends with error like
Here is complete playground for my issue https://www.online-python.com/AsZX867MEO
I can probably use my own type for that - that's why I ask here - but not sure how to use typeshed in runtime.
Then I can probably send PR directly to flask with fix for such edge cases (as nobody probably encountered this based on how long this is in flask already).
Thanks for you tips and help in advice.
The text was updated successfully, but these errors were encountered: