Skip to content

Backport type annotation syntax support for older python versions #771

Closed

Description

@jcrist
          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)

Activity

  1. jcrist commented on Nov 15, 2024

    @jcrist
    MemberAuthor

    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?

  2. ashb commented on Nov 15, 2024

    @ashb
    Contributor

    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

  3. jcrist commented on Nov 15, 2024

    @jcrist
    MemberAuthor

    Sounds good to me, thanks!

  4. ashb commented on Nov 15, 2024

    @ashb
    Contributor

    @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?

  5. jcrist commented on Nov 15, 2024

    @jcrist
    MemberAuthor

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions