Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/orsinium-labs/mypy-baseline
Integrate mypy in seconds with existing codebase. A friendly CLI tool to make mypy report only new type violations and ignore existing ones.
https://github.com/orsinium-labs/mypy-baseline
baseline cli gradual-typing legacy-code mypy python python3 static-typing typing
Last synced: 2 days ago
JSON representation
Integrate mypy in seconds with existing codebase. A friendly CLI tool to make mypy report only new type violations and ignore existing ones.
- Host: GitHub
- URL: https://github.com/orsinium-labs/mypy-baseline
- Owner: orsinium-labs
- License: mit
- Created: 2022-09-01T10:03:21.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2024-04-13T15:27:07.000Z (8 months ago)
- Last Synced: 2024-04-14T04:25:19.109Z (8 months ago)
- Topics: baseline, cli, gradual-typing, legacy-code, mypy, python, python3, static-typing, typing
- Language: Python
- Homepage: https://mypy-baseline.orsinium.dev/
- Size: 468 KB
- Stars: 46
- Watchers: 3
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-python-typing - mypy-baseline - Integrate mypy with existing codebase. A CLI tool that filters out existing type errors and reports only new ones. (Tools / Working with types)
README
# 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](./assets/example.png)
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
```bash
python3 -m pip install mypy-baseline
```## Usage
Create the baseline (it will be stored in `mypy-baseline.txt` by default):
```bash
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:
```bash
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](https://mypy-baseline.orsinium.dev/)