Exclude folder from mypy checking

The issue is that VS Code is invoking mypy file by file. And mypy doesn’t use the exclude option when invoked on a single file. The workaround is using python.linting.ignorePatterns in the settings.json.

 "python.linting.ignorePatterns": [ "venv/**/*.py" ]

More info about the behaviour of exclude:

Note that this flag only affects recursive discovery, that is, when mypy is discovering files within a directory tree or submodules of a package to check. If you pass a file or module explicitly, it will still be checked. For instance, mypy –exclude ‘/setup.py$’ but_still_check/setup.py.

I would still exclude this in the config file, for completeness’ sake, in case you run mypy by hand.

[mypy]
exclude = venv

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)