-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Open
Labels
bugmypy got something wrongmypy got something wrongtopic-error-reportingHow we report errorsHow we report errors
Description
Bug Report
Starting with mypy 1.19.0, the --output argument seems to be ignored when a .mypy_cache directory is present.
To Reproduce
Minimum working reproduction:
Have an incorrectly typed Python file.
# foo.py
wrong: str = 5Install the latest mypy version.
$ pip freeze
librt==0.6.3
mypy==1.19.0
mypy_extensions==1.1.0
pathspec==0.12.1
typing_extensions==4.15.0
Run mypy, with different formats:
$ rm -r .mypy_cache
$ mypy foo.py
$ mypy --output json foo.py
$ rm -r .mypy_cache
$ mypy --output json foo.py
$ mypy foo.py
Expected Behavior
Calls with --output json produce json output, calls without --output json do not (assuming nothing specified in config files).
Actual Behavior
The output format is taken from the first call
$ rm -r .mypy_cache
$ mypy foo.py
foo.py:1: error: Incompatible types in assignment (expression has type "int", variable has type "str") [assignment]
Found 1 error in 1 file (checked 1 source file)
$ mypy --output json foo.py
foo.py:1: error: Incompatible types in assignment (expression has type "int", variable has type "str") [assignment]
Found 1 error in 1 file (checked 1 source file)
$ rm -r .mypy_cache
$ mypy --output json foo.py
{"file": "foo.py", "line": 1, "column": 13, "message": "Incompatible types in assignment (expression has type \"int\", variable has type \"str\")", "hint": null, "code": "assignment", "severity": "error"}
Your Environment
- Mypy version used: 1.19.0
- Mypy command-line flags:
--output - Mypy configuration options from
mypy.ini(and other config files): none - Python version used: 3.14.0
Extra remarks
In a larger project, I have seen even --exclude being ignored on successive calls, but could not reproduce this yet in a minimal examples.
gooverdian and Nio-o
Metadata
Metadata
Assignees
Labels
bugmypy got something wrongmypy got something wrongtopic-error-reportingHow we report errorsHow we report errors