Closed StabbarN closed 1 year ago
How does dmypy know which files to observe, if we do not pass the path?
One way for dmypy to know what files to observe is to read files
in mypy.ini
on first run
.
I created a tiny test project to assert myself that it works.
main.py
:
import second
if __name__ == "__main__":
r = second.some_fn()
h = 12
test = r + h
print(test)
second.py
def some_fn() -> int:
return 1
mypy.ini
:
[mypy]
files = main.py
To verify:
dmypy run
return 1
to return "a"
.dmypy run
will give Incompatible return value type
. dmypy detects changes in second.py
.This requires a config file. I want the file checked, that I have currently open.
Furthermore, passing files is perfectly fine/the intended use case according to mypy documentation. https://mypy.readthedocs.io/en/stable/mypy_daemon.html#basic-usage
Well we seem to pass the option in the wrong order, but I would not expect that to be the issue.
Can you tell me a little more about the crash (steps to reproduce), maybe we can find a fix without compromising running without a config file? Is this even our fault? Seems like a mypy issue.
I see, yeah, it's probably a tougher mypy issue. The rather long stacktrace hints that it's a nontrivial fix. I've been pondering about filing an issue, but first I've to update the large project to the latest version of mypy. I'll do that in 2-3 months from now.
Mypy 1.4.1 is still problematic but instead of crashing dmypy
, it reports no errors.
dmypy
with both a config file and specify a file seems to still be the culprit. That is dmypy --config-file mypy.ini file.py
.
The bug lies outside this project so I'll close this PR.
Removing it from
dmypy
fixes the following crash:Mypy version 1.3 but this has been an issue in earlier versions too.
I don't see why one would give the file argument to
dmypy run
. The daemon will detect what files have changed by itself.