Are there any advantages to having mypy check only your entrypoints in your Python program versus every single file?
06:42 24 Nov 2025

I'm working with a large, existing Python codebase. Recently someone noticed that one of the files in the testsuite wasn't being type checked by mypy and so suggested to run python -m mypy . rather than python -m mypy entrypoint.py test/**/*.py. Unlike the previous approach, this doesn't miss any files inside of the test directory, but it also has the side-effect of that every file inside of the implementation module gets checked directly instead of indirectly by virtue of being imported by entrypoint.py. My intuition says that it makes more sense to only check entrypoint files, i.e. ones you would invoke directly as programs or tests in a testsuite. However, I don't know if there's any actual advantages to this approach.

Is there any reason to prefer explicitly checking every file or only checking your entrypoints and relying on automatic import discovery?

python mypy typechecking