Search code examples
pythonpython-3.7mypy

how to switch off mypy checking folders that do not have .py files


I've set mypy to run against /src/**/. When this runs I get errors such as

There are no .py[i] files in directory 'src/repos/__pycache__/'

Is there a way I can ignore certain paths?
I don't want to have to specify individual paths to every folder or file.


Solution

  • as per the comments, pointing mypy at the Python source files is probably the easiest option

    for other people coming across this question: this "solves" the issue because of how mypy handles command line arguments. if it's passed a directory name (as the OP had implicitly done) then it will look inside that directory for any Python files to check. this failed because the glob happened to match directories that didn't include any .py files.

    changing the glob to match names ending in .py means that it's likely to just pick up Python source files which keeps mypy happy