Skip to main content

Ease your way into static type checking by focusing on a small set of problems at a time.

It can be quite challenging to get an existing code base to pass mypy’s checks, even at its most lenient settings, and unfortunately, until you do you can’t use mypy as part of your CI/CD process.

mypy-runner lets you gradually introduce type checking by identifying a subset of files and errors to check:

  • choose a set of files and errors to check

  • get tests passing and enforce them in your CI and pre-commit hooks

  • repeat

Features

mypy-runner adds the following features to mypy:

  • Display colorized output

  • Convert specific errors to warnings

  • Filter specific errors and warnings

  • Automatically insert missing typing imports (see –add-missing-imports below)

Compatibility

mypy-runner supports mypy 0.730 and higher.

Options

usage: mypyrun [-h] [--version] [--daemon] [--select SELECT [SELECT ...]] [--ignore IGNORE [IGNORE ...]] [--warn WARN [WARN ...]] [--color] [--show-ignored] [--add-missing-imports] [--options OPTIONS] [--config-file CONFIG_FILE]
                  [--files FILES [FILES ...]] [--warning-filters WARNING_FILTERS [WARNING_FILTERS ...]] [--error-filters ERROR_FILTERS [ERROR_FILTERS ...]] [--mypy-executable MYPY_EXECUTABLE]
                  [ARG [ARG ...]]

positional arguments:
  ARG                   Regular mypy flags and files (precede with --)

optional arguments:
  -h, --help            show this help message and exit
  --version             show program's version number and exit
  --daemon              Run mypy in daemon mode (inverse: --no-daemon)
  --select SELECT [SELECT ...], -s SELECT [SELECT ...]
                        Errors to check
  --ignore IGNORE [IGNORE ...], -i IGNORE [IGNORE ...]
                        Errors to skip
  --warn WARN [WARN ...], -w WARN [WARN ...]
                        Errors to convert into warnings
  --color               Colorize output (inverse: --no-color)
  --show-ignored, -x    Show errors that have been ignored (darker if using color)
  --add-missing-imports
                        Add missing typing imports. This will detect mypy errors related to missing classes from the typing module and automatically insert them into the file
  --options OPTIONS, -o OPTIONS
                        Override the default options to use the namedconfiguration section (e.g. pass --options=foo to use the [mypyrun-foo] section)
  --config-file CONFIG_FILE, -c CONFIG_FILE
                        Specific configuration file.
  --files FILES [FILES ...]
                        Files to isolate (triggers use of 'active'options for these files)
  --warning-filters WARNING_FILTERS [WARNING_FILTERS ...]
                        Regular expression to ignore messages flagged as warnings
  --error-filters ERROR_FILTERS [ERROR_FILTERS ...]
                        Regular expression to ignore messages flagged as errors
  --mypy-executable MYPY_EXECUTABLE
                        Path to the mypy executable

As with tools like flake8, you use specific error codes to enable or disable error output. Errors that are ignored or converted into warnings will not trigger a non-zero exit status.

Configuration

mypyrun looks for a [mypyrun] section in either mypy.ini or mypyrun.ini.

Here’s an example configuration file:

[mypyrun]

# run dmypy instead of mypy
daemon = true

# only display these errors
select =
    not_defined,
    return_expected,
    return_not_expected,
    incompatible_subclass_attr,

# all other errors are warnings
warn = *

# filter errors generated from these paths:
exclude =
    thirdparty/*,

# pass these paths to mypy
paths =
    arnold/python,
    houdini/python,
    katana/python,
    mari/python,
    maya/python,
    nuke/python,
    python/packages,

Metadata

Release files for mypy-runner 0.6.0

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-runner 0.6.0
File Size Uploaded
mypy_runner-0.6.0.tar.gz 10.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mypy-runner 0.6.0
File Interpreter ABI Platform
mypy_runner-0.6.0-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 21.0 kB

Release files / mypy_runner-0.6.0.tar.gz

Download URL mypy_runner-0.6.0.tar.gz
Size 10.8 kB
Tags Source
SHA-256 checksum
How to use checksums
113a74e581b4d3abfc42aa2b129ef00abd7478e40fae8a6de743139eb1fdb32c
BLAKE2b-256 checksum
How to use checksums
ef23d3b8cee91d3bf7dea160d9e166b929582dcb4735fcdd0f845bc575414a02
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.4.2 CPython/3.7.9 Darwin/22.4.0

Release files / mypy_runner-0.6.0-py2.py3-none-any.whl

Download URL mypy_runner-0.6.0-py2.py3-none-any.whl
Size 10.2 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
abb36474620a52fbc55db2caf5087146dc85e4b301266f36ccd66c1cb0ff9489
BLAKE2b-256 checksum
How to use checksums
e98a2a1773de59b0760725dea4ebea9b757280983aa1c003caa5a407fd3c511d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.4.2 CPython/3.7.9 Darwin/22.4.0

Release history Release notifications | RSS feed

This release

0.6.0 This release

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

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