Mypy isn't excluding the specified folder

In my current working directory, I have a pytmx subfolder. This is an external library, if I try to run mypy . on it, it will throw a lot of errors that I would only know how to fix if I knew the code base. So instead, I’d like to exclude the folder from mypy analysis so I don’t have to worry about it.

I’ve tried a couple different things, one is providing a mypy.ini file:

[mypy]
exclude = pytmx

Doing this and running mypy . will still throw errors. This will also happen if I try to run mypy . --exclude pytmx.

What am I doing wrong here?

exclude only affects file discovery, not import following. Maybe try something like:

[mypy]
exclude = pytmx
[mypy-pytmx.*]
follow_imports = skip
1 Like