We're currently using Mypy (v 0.910) in our project with pyproject.toml for configuration. I have the following file structure: src --app --generated --service --data --ingest pyproject.toml: ... [tool.mypy] python_version = 3.8 disallow_untyped_defs = true exclude = "(src/app/generated)|(src/ingest)" ... When running with this configuration, the src/ingest folder is ignored, but not the src/app/generated folder. To test the regex, I also tried: ... [tool.mypy] python_version = 3.8 disallow_untyped_defs = true exclude = "(src/app)|(src/ingest)" ... mypy src --config-file ./pyproject.toml Success: no issues found in 1 source file which successfully ignored all files. I'm wondering why the first example is not ignoring src/app/generated folder. Continue reading...