How can I run mypy on all .py files in a project? I have seen I can specify a module to run mypy on but not something to specify a file mask or something like this.
To use this config file, place it at the root of your repo and run mypy. This config file specifies three global options in the [mypy] section. These three options will: Type-check your entire project assuming it will be run using Python 2.7.
Installing and running mypy This command makes mypy type check your program.py file and print out any errors it finds. Mypy will type check your code statically: this means that it will check for errors without ever running your code, just like a linter.
If all of your Python files live within a specific module or directory, then just running mypy folder_name
is fine.
You can also pass in multiple paths if you prefer to target specific files or modules. For example: mypy a.py b.py some_directory
.
The documentation has some more details and caveats.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With