Skip to main content

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

Usage

Create the baseline (it will be stored in mypy-baseline.txt by default):

mypy | mypy-baseline sync

After that, you can pipe mypy output into mypy-baseline filter, and it will filter out all issues that are already in the baseline:

mypy | mypy-baseline filter

If you introduce new errors, resolve them. If you resolve existing errors, run mypy-baseline sync again to re-generate baseline. In both cases, mypy-baseline will tell you what's wrong and what to do. Enjoy the ride!

Read more in the documentation: mypy-baseline.orsinium.dev

Metadata

Release files for mypy_baseline 0.7.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mypy_baseline 0.7.4
File Size Uploaded
mypy_baseline-0.7.4.tar.gz 319.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mypy_baseline 0.7.4
File Interpreter ABI Platform
mypy_baseline-0.7.4-py3-none-any.whl Python 3 none any Details

Total release size: 337.0 kB

Release files / mypy_baseline-0.7.4.tar.gz

Download URL mypy_baseline-0.7.4.tar.gz
Size 319.1 kB
Tags Source
SHA-256 checksum
How to use checksums
c69d9964ebb2922f53245336bc506d9d277c8a35349a60ce50cff0c48a8702cc
BLAKE2b-256 checksum
How to use checksums
087e484e07e1b27f9999f5f3f5097f0dfbb1ba756b0a2ed14acca764abad6cc8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.32.3

Release files / mypy_baseline-0.7.4-py3-none-any.whl

Download URL mypy_baseline-0.7.4-py3-none-any.whl
Size 17.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
012c5f2f2bf9770b0e846d22580a72b9d43bdfe04148fee10a8af47b5bdd35c7
BLAKE2b-256 checksum
How to use checksums
9e773dee0c8f219cc5e68e7d84abc1ecc315856104c459658890bd9ecce17815
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.32.3

Release history Release notifications | RSS feed

This release

0.7.4 This release

2 release files

0.7.3

2 release files

0.7.2

2 release files

0.7.1

2 release files

0.7.0

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.3

2 release files

0.5.2

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.5

2 release files

0.4.4

2 release files

0.4.3

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page