-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Add support for dataclasses #4792
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
Comments
Yes, we will definitely need a mypy plugin to support dataclasses. It can probably be somewhat similar to the existing one for attrs. |
It is good that you opened this issue, we definitely wanted to have a dedicated support for this, so now we have a place to track it. (Btw, I wanted to do this.) |
I'm not in the position to develop this plugin, so by all means give it a whirl if you want. I am actively using dataclasses though so I can help with testing.
… On Mar 26, 2018, at 2:15 PM, Ivan Levkivskyi ***@***.***> wrote:
It is good that you opened this issue, we definitely wanted to have a dedicated support for this, so now we have a place to track it. (Btw, I wanted to do this.)
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
One other point: I backported dataclasses to 3.6 as a third party module inside of a general-purpose utility package that I maintain. I wonder, will it be possible/easy to get this dataclass plugin to recognize that module for < 3.7? |
Yes. |
I have added preliminary support for dataclasses in python/typeshed#1944.
These seem to work for declarations, but not for instantiation. For example:
The constructor is erroneously flagged, and points to the
__init__
annotation forobject
:It appears that we need to teach mypy about dataclasses more deeply.
The text was updated successfully, but these errors were encountered: