mypy-baseline

0.7.3 · active · verified Sat Apr 11

mypy-baseline is a friendly CLI tool designed to integrate the `mypy` static type checker into existing Python projects. It works by creating and managing a 'baseline' file of current type errors, allowing developers to focus on new errors introduced while gradually addressing the existing technical debt. Currently at version 0.7.3, it maintains an active development and release cadence.

Warnings

Install

Quickstart

To get started, first ensure your mypy configuration (typically in `pyproject.toml`) includes `show_error_codes = true`. Then, generate an initial baseline to record all existing type errors. Subsequent runs can then filter mypy's output to only show new errors, helping to incrementally improve type coverage.

# 1. Ensure mypy is configured to show error codes (e.g., in pyproject.toml):
# [tool.mypy]
# show_error_codes = true

# 2. Generate the initial baseline (mypy-baseline.txt by default)
#    This will capture all current mypy errors.
mypy | mypy-baseline sync

# 3. Filter mypy output, reporting only new errors not in the baseline
mypy | mypy-baseline filter

# If you resolve existing errors or introduce new ones, run 'mypy | mypy-baseline sync'
# again to update the baseline.

view raw JSON →