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

Using typing.Annotated #1275

Open
AdrianSosic opened this issue Apr 8, 2024 · 1 comment
Open

Using typing.Annotated #1275

AdrianSosic opened this issue Apr 8, 2024 · 1 comment
Labels
Typing Typing/stub/Mypy/PyRight related bugs.

Comments

@AdrianSosic
Copy link

Hi, I'm not sure if this has been already discussed in some other context (and please just close if this is a duplicate) but I was wondering if there is already some debate on whether or not it makes sense to also support using typing.Annotated for attrs. For example, I've seen that pydantic uses the mechanism to allow binding validation to types instead of attributes, which I think is a neat concept that allows reusing the same semantic meaning across different contexts/classes. And I've already had several situations in my code where such a mechanism would have been useful, e.g. when attributes of different classes should undergo the exact same conversion/validation logic.

Are there any plans for this in attrs already?

@hynek
Copy link
Member

hynek commented Apr 9, 2024

There's no plans underway, no. The whole field seems also a bit in flux tbh but @Tinche might have opinions.

@hynek hynek added the Typing Typing/stub/Mypy/PyRight related bugs. label May 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Typing Typing/stub/Mypy/PyRight related bugs.
Projects
None yet
Development

No branches or pull requests

2 participants