Mypy JSON Report
A JSON report of your mypy output that helps you push towards full type coverage of your project.
Quickstart
Install with pip.
pip install mypy-json-report
Pipe the output of mypy through the mypy-json-report CLI app.
Store the output to a file, and commit it to your git repo.
mypy . --strict | mypy-json-report parse --output-file mypy-ratchet.json
git add mypy-ratchet.json
git commit -m "Add mypy errors ratchet file"
Now you have a snapshot of the mypy errors in your project. Compare against this file when making changes to your project to catch regressions and improvements.
Example output
If mypy was showing you errors like this:
example.py:8: error: Function is missing a return type annotation
example.py:8: note: Use "-> None" if function does not return a value
example.py:58: error: Call to untyped function "main" in typed context
example.py:69: error: Call to untyped function "main" in typed context
Found 3 errors in 1 file (checked 3 source files)
Then the report would look like this:
{
"example.py": {
"Call to untyped function \"main\" in typed context": 2,
"Function is missing a return type annotation": 1
}
}
Errors are grouped by file. To reduce churn, the line on which the errors occur is removed and repeated errors are counted.
Ratchet file
The --diff-old-report FILENAME flag serves two purposes.
-
It prints new (and adjacent, and similar) errors to STDERR. This is useful for seeing what errors need to be fixed before committing.
-
It will error when the ratchet file doesn't match the new report. This is helpful for catching uncommitted changes in CI.
Example usage
You could create a GitHub Action to catch regressions (or improvements).
---
name: Mypy check
on: [push]
jobs:
build:
runs-on: ubuntu-latest
mypy:
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.10"
- name: Install Python dependencies
run: |
pip install mypy mypy-json-report
- name: Run mypy
run: |
mypy . --strict | mypy-json-report parse --diff-old-report mypy-ratchet.json --output-file mypy-ratchet.json
Metadata
Release files for mypy-json-report 1.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| mypy_json_report-1.4.0.tar.gz | 10.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mypy_json_report-1.4.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 23.7 kB
Release files / mypy_json_report-1.4.0.tar.gz
| Download URL | mypy_json_report-1.4.0.tar.gz |
|---|---|
| Size | 10.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b0370415c7ee5a968b9f9abbba0fa11fd3647e7b98903abff85b323c42c61795
|
|
BLAKE2b-256 checksum How to use checksums |
f73043a0989ab2ea40a09d327246038f1db1b10621e292d991a121f9db81eb55
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 4, 2026.
Transparency logRelease files / mypy_json_report-1.4.0-py3-none-any.whl
| Download URL | mypy_json_report-1.4.0-py3-none-any.whl |
|---|---|
| Size | 13.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d9ecc59459b5d631328136e5299a55754cc1b9bbf0ce13d77840cb6e815fcd99
|
|
BLAKE2b-256 checksum How to use checksums |
6e338ef1bab6c13189902e3bcac91b0d821a763336c37af8457ee192e5ad147d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 4, 2026.
Transparency log