You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
empty directory among multiple targets aborts whole check #22173
When mypy is given more than one target and one of them expands to zero Python files, it exits with code 2 and emits no diagnostics for the other, valid targets.
I would expect only the empty target to be flagged with a warning and the remaining targets to still be checked. And only to be a fatal error when all given targets do neither contain a single Python file.
Context
mypy and dmypy show both the same issue here, which is why the issue is targeted to mypy alone. But the context of where this matters to me is in VS Code with the matangover.mypy extension which relies on dmypy. Where because of this preemptive exit, the extension cannot report anything about the files in the directories with Python files. And in that context, IMO it makes sense to insert multiple target dirs for future proofing (e.g. by configuring the search locations .github & . globally).
To Reproduce
# A directory containing only a Python file inside a dot-directory:
$ tree -a.── .github/ └── hooks/ └── enforce-tool-policy.py
$ mypy .github .
Expected Behavior
.github/hooks/enforce-tool-policy.py should still be type checked and its errors should be emitted.
Actual Behavior
$ mypy --config-file mypy.ini .github .There are no .py[i] files in directory '.'
# exit code 2
Mypy not being helpful because it does not analyze the file which does exist.
Activity
nightcityblade commentedon Oct 11, 2026
Hi, I'd like to work on this. I'll submit a focused PR with a regression test shortly.