Skip to main content

Integrate mypy with existing codebase.

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mypy_baseline-0.7.3.tar.gz (319.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mypy_baseline-0.7.3-py3-none-any.whl (17.9 kB view details)

Uploaded Python 3

File details

Details for the file mypy_baseline-0.7.3.tar.gz.

File metadata

  • Download URL: mypy_baseline-0.7.3.tar.gz
  • Upload date:
  • Size: 319.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.29.0

File hashes

Hashes for mypy_baseline-0.7.3.tar.gz
Algorithm Hash digest
SHA256 325f0695310eb8f5c0f10fa7af36ee1b3785a9d26b886a61c07b4a8eddb28d29
MD5 f8f21ad1726c65fbde8a698ab3d35e1b
BLAKE2b-256 652a03288dab6d5f24d187ba0c223f6b3035d9a29de3dd31a3e105a0d4f1b5da

See more details on using hashes here.

File details

Details for the file mypy_baseline-0.7.3-py3-none-any.whl.

File metadata

  • Download URL: mypy_baseline-0.7.3-py3-none-any.whl
  • Upload date:
  • Size: 17.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.29.0

File hashes

Hashes for mypy_baseline-0.7.3-py3-none-any.whl
Algorithm Hash digest
SHA256 bd7fa899e687d75af2e3f392a9d6d1790e65dae3d31fe12525cc14f26d866b74
MD5 6bf31e46e26cb2c289b71e3ee8116a93
BLAKE2b-256 1f937780302b206a8e8e767ce763ef06159725d1323acbe55e46a1cd1ffd109d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page