-
Notifications
You must be signed in to change notification settings - Fork 75
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
Inspection errors on valid union syntax for Python < 3.10 #737
Comments
Using a pipe for type unions was introduced in Python 3.10, so anybody running an earlier version of Python shouldn't be surprised by this. If you want to "extend" msgspec and use the pipe syntax, then your extension must require python >= 3.10. If you want to support use of earlier versions of Python, then you must use the |
Doesn't |
It looks like the reason the syntax error goes away is only due to the lazy computation. Thanks Chuck! |
No, that only allows for postponed evaluation of annotations. |
Yes thanks, I added a note for users earlier today! https://ofek.dev/msgspec-click/usage/#caveats |
Pydantic handles this via https://github.com/alexmojaki/eval_type_backport -- is there any appetite for doing the same in msgspec? Happy to PR it if that it'd be supported. @jcrist What would your appetite for it be? |
Thanks for the comment - I'd be open to doing something like that. I've opened #771 to track this, lets continue discussion there :). |
Description
The following code:
produces the following:
The following code is a workaround but limits what users are allowed to do when providing a library that extends msgspec:
The text was updated successfully, but these errors were encountered: