msgspec / msgspec/msgspec

Should we integrate with `annotated-types`?

Open
#177 8 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
4.1k
Forks
193
Avg merge
3d 20h
Merged PRs (30d)
15

Description

Follow up from #176 and #154.

We currently support adding constraints to types by annotating them with msgspec.Meta. annotated-types provides it's own annotations describing the same constraints - we could potentially integrate with them in 2 ways:

  • Consume annotated-types annotations. This would let msgspec work with annotated types annotations as well as our own built-in Meta annotations.
  • Produce annotated-types annotations. This would make Meta.__iter__ produce the equivalent annotated-types annotations, letting it work with other tools that consume such types.

I'm not convinced there's a real use case for either of these integrations, and would want to hear from multiple real users before expending any effort supporting this. See https://github.com/jcrist/msgspec/pull/176#issuecomment-1229265714 for a longer write up of my thoughts.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading follow-ups #176 and #154, then review the linked pull request discussion and the behavior of Meta.iter. Compare the two proposed integration directions—consuming or producing annotated-types annotations—and look for concrete user needs. The issue is done only once a supported direction and scope have been agreed.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.