mypy-baseline

A CLI tool for painless integration of mypy with an existing Python project. When you run it for the first time, it will remember all type errors that you already have in the project (generate “baseline”). All consecutive runs will ignore these errors and report only ones that you introduced after that.

Additionally, the tool will show you what progress you made since the last baseline, to encourage your team to resolve mypy errors:

example of the command output

Features:

  • Battle-tested.

  • Fast and simple.

  • Pure Python.

  • No mypy patching or dirty magic. The tool works exclusively with the stdout of mypy.

  • Nice stats with colors.

  • Can detect exactly what errors were introduced and what errors were resolved, even if they are in the same file.

  • Baseline is carefully crafted to avoid merge conflicts.

  • Baseline is human-readable, and diffs are informative. The reviewers of your PR will know exactly what errors you resolve and what errors you introduced.

  • Track the progress you make with git-based history of changes and burndown chart of resolved type violations.

  • Ignore specific error messages (using regular expressions) and error categories, so that buggy mypy plugins don’t bother you with false-positives.

Installation

python3 -m pip install mypy-baseline

Source code is available on GitHub: github.com/orsinium-labs/mypy-baseline

Documentation