Mypy Processor
Purpose
Type-checks Python source files using mypy.
The Rust alternative is pyrefly, a Python type checker written in Rust, which the fleet type-checks with. It is a different checker, not a port of mypy: its findings are its own.
How It Works
Discovers .py files in the project (excluding common non-source directories),
runs mypy on each file, and creates a stub file on success.
A non-zero exit code from mypy fails the product.
This processor supports batch mode, allowing multiple files to be checked in a single mypy invocation for better performance.
If a mypy.ini file exists in the project root, it is automatically added as an
extra input so that configuration changes trigger rebuilds.
Source Files
- Input:
**/*.py - Output: none (checker — a passing check is recorded in the cache, no file is written)
Configuration
[processor.checker.mypy]
command = "mypy" # The mypy command to run
args = [] # Additional arguments to pass to mypy
dep_inputs = [] # Additional files that trigger rebuilds (e.g. ["pyproject.toml"])
| Key | Type | Default | Description |
|---|---|---|---|
command | string | "mypy" | The mypy executable to run |
args | string[] | [] | Extra arguments passed to mypy |
dep_inputs | string[] | [] | Extra files whose changes trigger rebuilds |
output_depends_on_input_name | bool | true | Key cached results by file path as well as content, because mypy derives module identity and per-module settings from the path. A renamed file is re-checked instead of reusing its old verdict. See output_depends_on_input_name |
Batch support
The tool accepts multiple files on the command line. When batching is enabled (default), rsconstruct passes all files in a single invocation for better performance.
Using mypy.ini
Mypy automatically reads configuration from a mypy.ini file in the project
root. This file is detected automatically and added as an extra input, so
changes to it will trigger rebuilds without manual configuration.
Clean behavior
This processor is a Checker — rsconstruct clean outputs is a no-op for it (checkers produce no outputs). See Clean behavior and rsconstruct clean.