mypy
mypy copied to clipboard
Optional static typing for Python
**Bug Report:** In the below example ([playground gist](https://mypy-play.net/?mypy=latest&python=3.12&gist=efc877f4e1d37e52a2cb2c06237efe4b)), mypy behaves differently with respect to `**kwargs`: ```python def func(x: bool = False, **kwargs): print(x, kwargs) # This is accepted by mypy....
## Overview Currently if you import anything from a third-party package that has inline types, mypy will process all the transitive dependencies of the imported module as well. This can...
**Bug Report** I have inherited a project, where one class implements `__format__(self, format_spec: str) -> str` to implement a custom type for formatting. Running `mypy` on that code throws a...
**Bug Report** When calling a generic `__init__` from a generic `@classmethod` on a class that is itself *not* generic, `mypy` reports incompatible types. **To Reproduce** ```python from typing import TypeVar...
Currently an instance variable can be accessed using the class, which is wrong. For example, this code is accepted by the type checker: ``` class A: def f(self) -> None:...
See last line ([Playground](https://mypy-play.net/?mypy=1.11.2&python=3.12&gist=9ea836c7c5329006478e0a0b40e6ce5d)): ```python from collections.abc import Iterator, Generator from typing import Any, Iterable, TypeVar, overload from typing_extensions import assert_type T = TypeVar("T") IterableT = TypeVar("IterableT", bound=Iterable) @overload def...
**Documentation** while fixing issue #17870 , I opened the PR #17933 , after the merge of that PR, I noticed the following behavior: When we view the latest branch, the...
Mypy generates no error, even though the code is unsafe: ```py class C[T]: a: T def f(x: C[int] | C[str]) -> None: x.a = 1 # No error c =...
**Feature** We Know that mypy and typing now support ```python from typing import TypedDict, Optional, Literal class OverlapsDict(TypedDict): id: int seq_id: int pr_order: int pos1: int seq: str pos2: int...
**Bug Report** `Self` as return type annotation in base class method breaks multi-inheritance. (A clear and concise description of what the bug is.) **To Reproduce** ```python import copy from typing...