According to the official doc, if using mypy.ini
or setup.cfg
, the content of the exclude
field in the configuration file seems have to be a regular expression, e.g.:
[mypy]
exclude = (?x)(
^one\.py$ # files named "one.py"
| two\.pyi$ # or files ending with "two.pyi"
| ^three\. # or files starting with "three."
)
On the other hand, if you use pyproject.toml
as the configuration file, the content of the exclude
field could be of two forms: (1) a single regular expression (as above); (2) an array of strings as follows:
[tool.mypy]
exclude = [
"^one\\.py$", # TOML's double-quoted strings require escaping backslashes
'two\.pyi$', # but TOML's single-quoted strings do not
'^three\.',
]
So, it seems that using an array of file/dir-names (not a RegEx) be not allowed for MyPy, which is different from that of flake8
(just only an array of file/dir-names is OK).