mypy icon indicating copy to clipboard operation
mypy copied to clipboard

Optional static typing for Python

Results 1055 mypy issues
Sort by recently updated
recently updated
newest added

**Bug Report** Mypy gives an inconsistent result when run on the same code. **To Reproduce** Create the following file: ```python # test.py from typing import Any, Generic, Tuple, TypeVar, overload...

bug

**Crash Report** Running dmypy multiple times results in a KeyError. The error is always on files we exclude in our `mypy.ini`. **Traceback** ```python-traceback [nick@Mac] ~/workspace/mypy-playground [bug-dmypy-key-error] $ uv run dmypy...

crash
topic-daemon

This PR fixes how mypy handles generic classes with default type parameters when they refer to themselves inside the class body. It Fixes #20336 Before this change, if you wrote...

Two related issues (#19444 and #19362) were fixed in #19449, but I discovered that swapping type variables still gives incorrect results if the generic type contains some additional optional type...

bug
topic-type-variables
priority-1-normal

Example courtesy of @gvanrossum , based on https://twitter.com/gvanrossum/status/1354305179244392453 While Python's behaviour is surprising, mypy should match it. ``` from typing import * x: Optional[int] = None y: Optional[int] = None...

bug
priority-2-low
good-second-issue
topic-runtime-semantics
topic-variable-scope

**Crash Report** I noticed this crash when running mypy on the cpython codebase. **Traceback** ```python-traceback Traceback (most recent call last): File ".venv-mypy/bin/mypy", line 7, in sys.exit(console_entry()) File "mypy/mypy/__main__.py", line 15,...

crash
priority-2-low

Fixes #16919, fixes #16890 ~It's possible we should not issue the diagnostic and only return object, but that may confuse users. [Let's see the primer](https://github.com/python/mypy/pull/18095#issuecomment-2453341307).~ Should also probably disallow `type[P]`...

**Bug Report** When I use a `TypeIs` on a union of a `TypeVar` and something else (for example `int`), it seems the negative type narrowing does not work. mypy accepts...

bug
topic-type-narrowing
topic-typeguard-typeis