-
Notifications
You must be signed in to change notification settings - Fork 14
mypy plugin broken with mypy==0.730, works with 0.711 #21
Comments
Thanks for trying it out! Sorry for my slow replies (past and future). Just for due diligence' sake, do you see these issues if you manually install |
Confirmed in a venv, works flawlessly with |
The 0.720 release notes say:
They moved to their new semantic analyzer as the default in this version. |
Ah details: python/mypy#6617 |
probably the same issue, but updated console log for mypy 0.750:
adt is great, so it's kinda of a pity it cannot be properly type checked right now with mypy :-( Is there any workaround for this? thanks a lot for adt ! |
There's a workaround in pinning to |
So I have been looking into this for a few days, now. It seems like mypy changed the way and timing of the execution of the hooks. There are three issues (so far) we need to solve:
An alternative would be to request Edit: I realized that some of my test cases are wrong (due to the readme containing a typo) and some are also failing in the current version for mypy 0.711. I'm going to check which errors are actually due to the mypy version and give an update here. |
* Add test cases for issues jspahrsummers#21, jspahrsummers#25, jspahrsummers#26 * Test case for jspahrsummers#21 is active because it passes with mypy==0.711 * Test cases for jspahrsummers#25 and jspahrsummers#26 are deactivated because they fail
* Add test cases for issues jspahrsummers#21, jspahrsummers#25, jspahrsummers#26 * Test case for jspahrsummers#21 is active because it passes with mypy==0.711 * Test cases for jspahrsummers#25 and jspahrsummers#26 are deactivated because they fail
* Add test cases for issues jspahrsummers#21, jspahrsummers#25, jspahrsummers#26 * Test case for jspahrsummers#21 is active because it passes with mypy==0.711 * Test cases for jspahrsummers#25 and jspahrsummers#26 are deactivated because they fail
@wchresta I took a cursory glance at these, based on your (very helpful) write-up, and in conjunction with the mypy plugin notes (found via the link @kastiglione shared).
I wasn't able to confirm this one--when adding some logging into adt's My hypothesis is that type analysis is unintentionally getting triggered by adt while the class definition is being modified. I haven't dug deeper than that, though. Sorry for the poorly-documented code, and wherever conventions in the project might be weird! Ironically, I wasn't very experienced in Python while building this. 😅 |
@jspahrsummers yeah, at first it looked to me like that, too. I then took a debugger to observe mypy's internals. It seems like the output of the error messages might be buffered; the fail method seems to be called before our hook gets executed. The reason for this is here: The type analyzer with raises the failure is ran when Anyway, it seemed like this is the only real problem with the new semantic analyzer. The other problems were either wrong syntax on my part or have already existed. |
Should be fixed with #28 |
I'm just dipping my toe into type-checking with mypy and adt, but I seem to still be getting this error with mypy 0.782. Can anyone else confirm that this bug is fixed?
|
oh, never mind, it's because I didn't have the plugin enabled! |
@radix oh... can confirm! Upd: doesn't matterulidtko@pasocon ~ > cat test.py
from adt import adt, Case
@adt
class Cmd:
READKEY: Case[str, str]
WRITEKEY: Case[str, str, str]
DELETEKEY: Case[str, str]
ulidtko@pasocon ~> mypy test.py
test.py:5: error: "Case" expects no type arguments, but 2 given
test.py:6: error: "Case" expects no type arguments, but 3 given
test.py:7: error: "Case" expects no type arguments, but 2 given
Found 3 errors in 1 file (checked 1 source file)
ulidtko@pasocon ~ [1]> mypy --version
mypy 0.782 Haha, I've fallen into the same trap again :) Sure, you need to add this into [mypy]
plugins = adt.mypy_plugin |
Hi! Nice work, thanks for publishing, absolutely appreciated.
Let's take a tiny example:
This works just fine on the REPL, but the mypy plugin thing isn't giving it to me:
Of course I followed the README, and had put the lines in the project's
setup.cfg
:I'm abolutely sure that the plugin gets loaded:
mypy
spews errors as expected whenever I garble the config. But the complaints are still there. Python 3.6; mypy 0.730 — the freshest at pypi right now.Do you see anything I'm missing? Or if you could perhaps retest with recent mypy, perhaps they broke the plugin...
The text was updated successfully, but these errors were encountered: