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

`mypy` reports success for ```python import numpy as np x = "a" assert isinstance(x, np.float64) ``` but fails for ```python from numpy import float64 x = "a" assert isinstance(x, float64)...

bug
topic-pep-604

This is not an issue in 0.91, but it occurs in master. Given a metaclass that overrides `__or__`, the correct type is only maintained in the immediate result. If the...

bug
topic-overloads
topic-metaclasses

**Bug Report** mypy respects platform conditions using `sys.platform` variable, but do not recognize `os.name`. Related issue: #8166 **To Reproduce** Consider this piece of code, assuming we are on Linux: ```...

feature
priority-2-low

mypy 1.8.0, python 3.10.10 So tuple types get matched and checked normally in simple situations like this: ```python a: tuple[int, int] = (2, "a") # Incompatible types in assignment ......

bug

Consider the following code: ```python from __future__ import annotations from collections.abc import Iterable from packaging.version import Version def best_str(strs: Iterable[str]) -> str | None: return max(strs, key=keyfunc, default=None) def keyfunc(s:...

bug
topic-type-variables
topic-union-types

**Bug Report** mypy seems to get confused about type of `typing.Self`, when class is also `typing.Generic`, inside methods if a parameter has the same type as the class Generic's TypeVar....

bug

**Crash Report** When I run mypy on our codebase, it works fine. When I enable pydantic plugin, it crashes. Pyproject: ```toml [tool.mypy] plugins = [ "pydantic.mypy" ] python_version = "3.10"...

crash

**Bug Report** Using `isinstance(, tuple)` narrows the type of `` to `Tuple[Any, ...]`, not `Tuple[X, ...]` as one would expect. **To Reproduce** [[mypy-play.net](https://mypy-play.net/?mypy=latest&python=3.8&gist=701b1cfe60a28131ab63a43d4be8e9ec)] [[pyright-play.net](https://pyright-play.net/?strict=true&code=GYJw9gtgBA%2BjwFcAuCQFM5QJYQA5hCSgEMA7UsJYpLMUgZwChRIokBPXLUgcxjQAeSNA1oNseAkQAUjKPIXzi9emkIwOuNABo5ihQGU0ARwQiAxjr36oAFQS4ANlZvyAlI08ATNMCg80JBgAN2JHM2k3KABaAD4oI1MLNABteiQQAF0ALmsodBQQUigAOjL5AGI2TjRs7B4KdE9Q8LQoAF5-QJCwiI9GLD8sem50sktpFrNtNgdnN1zFZVV1TTRJ3p07OdT0kBmyksyPV30qwS1zYS866SQAC2GoAHcCAGt6E9OFKuIrhDCtweT1eIA%2BbiAA)[^1]] (pyright handles this as expected) ```python...

bug
topic-type-narrowing

Wanted to cross-post this issue from Pyright: https://github.com/microsoft/pyright/issues/7291 From giving this same example a try in the [MyPy playground](https://mypy-play.net/?mypy=latest&python=3.12). (Version 3.12, MyPy 1.8.0). We see that that MyPy complains about...

bug

**Feature** Mypy should allow using `mypy: ignore` comments, treating them exactly the same as the equivalent `type: ignore` comment. **Pitch** Currently, mypy supports `type: ignore` comments for suppressing errors only...

feature
topic-type-ignore