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** I can't import stuff out of un-stubbed parts of the stubbed `boto` module anymore as of the new release of the stubs. Also, changing the installed stub version...

bug

**Bug Report** On **python 3.11** using **StrEnum**, if converting given enum to a list and assigning to a variable, mypy will wrongly assumes that given variable will be `list[str]`, not...

bug
topic-enum

**Bug Report** mypy ignores the `x` expression in `Annotated[T, x]` without type-checking it. Although `x` has no effect on the typing interpretation of `T`, the expression `x` is still code...

feature
topic-runtime-semantics

`error: Need type annotation for "redis_cluster" [var-annotated]` Code: ```c++ async with (RedisMap(self.conf_redis["host"], self.conf_redis["port"], use_async=True) as redis_map, RedisCluster(host=self.conf_redis_cluster["host"], port=self.conf_redis_cluster["port"], socket_timeout=REDIS_TIMEOUT, decode_responses=True) as redis_cluster, NetatmoClientAsync() as netatmo_client): await self.order_manager.run(url, redis_map, redis_cluster, netatmo_client)...

bug

```py from typing import Literal def f() -> Literal[""]: a = "" return a and exit() # error: Incompatible return value type (got "str", expected "Literal['']") [return-value] ```

feature

https://github.com/python/mypy/pull/14191#issuecomment-1328372923 ```py a: list[int] for i in a: if i: b = i break else: b = 1 print(b) # error: Name "b" may be undefined [possibly-undefined] ```

bug
topic-possibly-undefined

When checking the following code: ```py from typing import AbstractSet, Iterable, Optional, Set, TypeVar T = TypeVar('T') def intersection(seq: Iterable[AbstractSet[T]]) -> Optional[Set[T]]: ret = None for elem in seq: if...

bug
topic-reachability

**Bug Report** When using an `if`/`else` in class scope of an Enum definition, there is a false error "Attempted to reuse member name in Enum definition". I understand mypy might...

bug
topic-enum

**Feature** `ruff` has an `--add-noqa` option to add `noqa` directives in all places: https://docs.astral.sh/ruff/linter/#inserting-necessary-suppression-comments It would nice if `mypy` had something similar, like a `--add-ignore` CLI argument **Pitch** This would...

feature

**Bug Report** Doesn't seem possible to use jnp.numpy64 as a type hint in python 3.8 (works in python3.9 and 3.10). See https://github.com/EmmanuelMess/ConstraintBasedSimulator/actions/runs/7805111999/job/21288560174 **To Reproduce** First file that throws the error:...

bug