When comparing mypy vs flake8, the Slant community recommends flake8 for most people. In the question“What are the best Python code linters?” flake8 is ranked 2nd while mypy is ranked 5th. The most important reason people chose flake8 is:
Project-level settings for flake8 are in the tox settings file. It is trivial to run flake8 inside setup.py or pavement.py.
Specs
Ranked in these QuestionsQuestion Ranking
Pros
Pro Powerful type checker
Mypy's type checker checks the types of function parameters, supports type inference, typed collections and has even some support for generics.
Pro Works in a truly static way
Mypy works in a truly static way. The checker makes all the checks before the code is actually run, but it still catches a lot of bugs.
Pro Integration with build tools like tox
Project-level settings for flake8 are in the tox settings file. It is trivial to run flake8 inside setup.py or pavement.py.
Pro Allows usage of and writing of plugins
Flake8 has the ability to run thrid-party plugins, including plugins you can write yourself. Here you can find a few useful plugins.
Pro Easy to ignore files and lines
Add "noqa" comments to files and lines to skip processing. Code comments make it easy to find and review exceptions with grep.
Pro Wraps multiple analysis tools
Flake8 is a wrapper around PyFlakes, pep8, and McCabe Complexity analysis.
Cons
Con Still an experimental project
Mypy is still an unfinished experimental project. It is prone to bugs and to features being changed and removed. Plus, a large part of Python features is yet to be implemented.