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 consequentive 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 speicific error messages (using regular expressions), 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.5.1.tar.gz (318.6 kB view details)

Uploaded Source

Built Distribution

mypy_baseline-0.5.1-py3-none-any.whl (17.4 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for mypy_baseline-0.5.1.tar.gz
Algorithm Hash digest
SHA256 fb999f20278fb4c2cbb925d41d701608ff00d2a179d6e8bcdde6ef163ea42514
MD5 04d1037274fbb2717b283025c9b5ed84
BLAKE2b-256 642c5f23d2663b5f0cf458c2a1b078b6f3d18c2ac4defa080fc196f4c0a010eb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mypy_baseline-0.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c8ac30d976c3c200b92f2a8f09e98ec7c65b8722576a3a67c621dd76e168ca61
MD5 f8124ef1149bfcfebf25cca6ded9b7b9
BLAKE2b-256 81ee7bcf61ea09499d4948c456fb996fd2d1c74a797e9325ea3a262be49afb28

See more details on using hashes here.

Supported by

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