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

Backport type annotation syntax support for older python versions #771

Open
jcrist opened this issue Nov 15, 2024 · 5 comments · May be fixed by #773
Open

Backport type annotation syntax support for older python versions #771

jcrist opened this issue Nov 15, 2024 · 5 comments · May be fixed by #773

Comments

@jcrist
Copy link
Owner

jcrist commented Nov 15, 2024

          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.

Originally posted by @ashb in #737 (comment)

@jcrist
Copy link
Owner Author

jcrist commented Nov 15, 2024

A few options I see here:

  • Do as pydantic does (use eval_type_backport if installed, error otherwise and suggest the user install it). This keeps it as an optional dependency.
  • Add it as a mandatory dependency for older python versions. This would be our first mandatory dependency though, so I'm -0.5 on that.
  • Write our own implementation (looking at their code, I think there's a simpler way we could add support here). Downside here is this is all hacks and it'd be hacks we'd maintain rather than someone else.

I'd be open to either option 1 or 3. Thoughts @ashb? Is this something you'd be interested in contributing?

@ashb
Copy link

ashb commented Nov 15, 2024

In terms of effort I can spare l make time to do no.1, not sure I've got the spare cycles to do a full implementation.

Happy to pr approach 1

@jcrist
Copy link
Owner Author

jcrist commented Nov 15, 2024

Sounds good to me, thanks!

@ashb
Copy link

ashb commented Nov 15, 2024

@jcrist Re testing: am I right in thinking that the cibuildwheel will test against multiple versions of python, so do I need to convice the GHA pipeline to run 3.9 with and without the dep installed?

@jcrist
Copy link
Owner Author

jcrist commented Nov 15, 2024

There are ways to hack in testing without it I installed that wouldn't require another ci build - if you could just write tests for behavior with it installed I can add/fixup those afterward.

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 a pull request may close this issue.

3 participants
@ashb @jcrist and others