-
-
Notifications
You must be signed in to change notification settings - Fork 385
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Mypy improvements #890
Mypy improvements #890
Conversation
Is this something that should remain open? |
Yeah, we need to merge this when Mypy release 0.940 I believe. |
Maybe we should get it to pass CI until then. 😇 |
I can't until Mypy releases :p |
eg ok, your phrasing sounded like it's needed, once mypy is out |
It's just more sophisticated type stubs, we don't have to match their release exactly. But we might want to. |
@Tinche I noticed recently that using attrs 21.4.0 and the new |
The new attrs namespace is absolutely supported by mypy. I use it all the time. We've achieved it by re-importing symbols from the |
Hmm, OK, thanks for the info! I guess let me convert this project at work back to the attrs namespace and see if I can figure out what's going on. :-) While I have you, I assume it's expected that mypy cannot handle "fancy converters" -- I get |
@hynek To follow up on the issues I mentioned in this project I'm working on, when I use the
|
Unfortunately, mypy support for converters is very bare-bones. There's not much we can do about it. Your error must have some other cause. It's explicitly tested here: Line 414 in 7804a68
|
@hynek OK, thank you. I'll study it more and if I can't find a cause on my side, I'll try to open a ticket with very bare-bones example code that recreates it. And maybe I'll open a PR that adds a comment to the docs re converters being limited just so others know about the limitations. Thank you again! |
@hynek this should go in now. I guess I need to rebase though. |
@Tinche this is breaking even on 3.6…wanna wait until this stuff is fixed in mypy? :-/ |
Mergy mergy now? |
Allmost all of CI redy redy? |
|
Since python-attrs/attrs#890 (≥ 22.1.0) `attrs.fields` is typed to accept a protocol. Since python-attrs/attrs#997 (≥ 22.2.0) `attrs.has` is a type-guard. Support both by removing the explicit error reporting and letting it fall through to the type stub. Fixes #15980.
Not to be merged yet.
The problem is the Mypy plugin doesn't return a namedtuple, but an ordinary tuple. We should fix this in the Mypy plugin.