-
Notifications
You must be signed in to change notification settings - Fork 77
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
why is type checking not supported for marshmallow_dataclass in PyCharm? #178
Comments
So, as a workaround, I found this. It is one extra annotation that gets rid of the annoying incorrect warnings but if someone here can explain to me why just using the @marshmallow_dataclass.dataclass doesn't give the same behavior, then that'd be great. Thanks! |
It seems the @add_schema annotation gets rid of all types of PyCharm warnings entirely. If anyone has a workaround to this issue then that'd be great. |
FYI - it's not just a PyCharm thing. My code is currently not passing mypy at all. Here's a super basic example that hopefully (it's a scaled down version of production code) reproduces it:
the above code is currently giving me a mypy error I decorate RecipientForm with
I don't get this mypy error when I decorate with Aside: My real-world scenario is a bit gnarlier than the contrived example above - i.e., I realize that for this example, I could just create my Schema class with
and forgo the mashmallow_dataclass version of the |
Here's a better example showing the problem: https://gist.github.com/mdesjardins/2d2eb37bad865b8037800d0bbb07a18a |
Related to this, if you try to construct a class with a |
I was using the normal dataclass before and type checking worked fine inside PyCharm for that but that doesn't seem to be the case when I use the @marshmallow_dataclass.dataclass annotation over my class instead of the usual @dataclasses.dataclass one. Is there a special reason for it being this way? Seeing my dataclass declaration become entirely yellow in PyCharm (an incorrect warning) is very annoying
The text was updated successfully, but these errors were encountered: