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

Playground url: https://mypy-play.net/?mypy=latest&python=3.12&flags=strict%2Cwarn-unused-configs&gist=d2e9766efcc27a2bc27d7226c0f6b444 ```python def cond1() -> bool: return True def cond2() -> bool: return True def foo() -> None: if cond1(): a = '' return if cond2(): a =...

bug

I'd like to be able to write code like; ```python from typing import * SortedList = NewType('SortedList', List) A = TypeVar('A') def my_sorted(items: List[A]) -> SortedList[A]: ... ``` Currently I...

topic-newtype

```py from typing import TypeVar, TypeAlias T = TypeVar("T") MaybeList = T | list[T] # error: Type variable "__main__.T" is invalid as target for type alias MaybeList2: TypeAlias = T...

bug

Documents the new option added by https://github.com/python/mypy/pull/11396.

Fixes #16543 Outputs the class docstring in the `InspectionStubGenerator`, dependent upon the --include-doc setting. I've attempted to add tests to verify it, but it looks like the stubgen pytests are...

**Bug Report** Mypy complains when I try to call get on an empty dict. **To Reproduce** ```python x = {}.get("x") ``` **Expected Behavior** No error. **Actual Behavior** ``` a.py:1: error:...

bug

Fix `TypeIs` narrowing for types with type parameters in `Union` types. Addresses: https://github.com/python/mypy/issues/17181 Example: ``` bar: list[int] | list[str] if is_list_int(bar):

upnext

**Feature** Report where `@deprecated` symbols are used in the code. **Pitch** Python 3.12 is coming soon, and it introduces [PEP 702](https://peps.python.org/pep-0702/) (the `@deprecated` decorator).`mypy` should support it.

feature

**Feature** See [PEP 696 – Type defaults for TypeVarLikes](https://peps.python.org/pep-0696/) for details. The PEP has not yet been accepted though. Example from the PEP: ```python T = TypeVar("T", default=int) # This...

feature
topic-pep-696

Fixes #17447 This allows generating inline generics for stubgenc by using `__type_params__`. Similar to #17463 but for `__type_params__` instead of `__annotations__`

topic-stubgen