{"id":4128,"library":"mypy-baseline","title":"mypy-baseline","description":"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.","status":"active","version":"0.7.3","language":"en","source_language":"en","source_url":"https://github.com/orsinium-labs/mypy-baseline","tags":["mypy","type checking","tooling","cli","development","static analysis"],"install":[{"cmd":"pip install mypy-baseline","lang":"bash","label":"Install mypy-baseline"}],"dependencies":[{"reason":"mypy-baseline processes the stdout of mypy, making mypy a required peer dependency for functionality. It is not listed as an install_requires.","package":"mypy","optional":false}],"imports":[],"quickstart":{"code":"# 1. Ensure mypy is configured to show error codes (e.g., in pyproject.toml):\n# [tool.mypy]\n# show_error_codes = true\n\n# 2. Generate the initial baseline (mypy-baseline.txt by default)\n#    This will capture all current mypy errors.\nmypy | mypy-baseline sync\n\n# 3. Filter mypy output, reporting only new errors not in the baseline\nmypy | mypy-baseline filter\n\n# If you resolve existing errors or introduce new ones, run 'mypy | mypy-baseline sync'\n# again to update the baseline.","lang":"bash","description":"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."},"warnings":[{"fix":"Add `show_error_codes = true` under your `[tool.mypy]` section in `pyproject.toml` or equivalent mypy configuration.","message":"mypy-baseline relies on mypy outputting error codes. Ensure your `mypy` configuration (e.g., in `pyproject.toml`) has `show_error_codes = true` for correct operation.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Upgrade to mypy-baseline 0.7.3 or newer to ensure correct baseline synchronization when using the `--sort-baseline` option.","message":"Versions 0.7.0 to 0.7.2 had a bug where the `--sort-baseline` option could cause incorrect stable sync behavior. This was fixed in 0.7.3.","severity":"gotcha","affected_versions":"0.7.0 - 0.7.2"},{"fix":"Upgrade to mypy-baseline 0.7.2 or newer to ensure `pyproject.toml` configurations (e.g., for `baseline_path`) are correctly respected.","message":"mypy-baseline versions prior to 0.7.2 had a bug where configuration in `pyproject.toml` might be ignored, leading to unexpected behavior or reliance on CLI flags.","severity":"gotcha","affected_versions":"<0.7.2"},{"fix":"Run `mypy | mypy-baseline sync` to update your baseline file after resolving existing errors or making changes that affect the baseline.","message":"The tool will intentionally fail if there are resolved but unsynced errors in your codebase. This is by design to encourage keeping the `mypy-baseline.txt` file up-to-date.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}