mypy
mypy copied to clipboard
Optional static typing for Python
**Bug Report** It looks like mypy cannot detect some types like following type. **To Reproduce** Playground: https://mypy-play.net/?mypy=latest&python=3.12&gist=f83671bbbc02711ac90962ae786b418b ```python from typing import Union, Type, Tuple, TypeVar T = TypeVar("T") def some_types(type_:...
## Bug Report I'm explicitly typing a variable with `Type` (or `type`) and mypy thinks I should not subclass it. ## To Reproduce ```python from typing import Type class Base:...
@alexander255 has requested a flag `--pep561-override` to allow listing packages as pep 561 compatible when they are not. This got me thinking and I think the best UX for this...
**Bug Report** I have not been able to find any issues discussing a similar situation, so I'm filing this bug. I apologize in advanced if this is just a configuration...
**Bug Report** We can't use TypeVar with star operator, maybe I wrongly used TypeVar. Thanks **To Reproduce** ```python T = TypeVar("T", str, int) def test(a: Sequence[T]) -> list[T]: return [*a]...
### Improve inference/narrowing support for union types in match statements. Fixes #17549 Before: ```py var: tuple[int, int] | tuple[str, str] # TODO: we can infer better here. match var: case...
I feel like this code should work but it doesn't. Am I missing something? ``` from typing_extensions import assert_never class Left1: pass class Left2: pass class Right1: pass class Right2:...
```py def foo() -> None: _ = [1] # error: no-any-expr ``` [playground](https://mypy-play.net/?mypy=latest&python=3.12&flags=show-error-codes%2Cstrict%2Ccheck-untyped-defs%2Cdisallow-any-decorated%2Cdisallow-any-expr%2Cdisallow-any-explicit%2Cdisallow-any-generics%2Cdisallow-any-unimported%2Cdisallow-incomplete-defs%2Cdisallow-subclassing-any%2Cdisallow-untyped-calls%2Cdisallow-untyped-decorators%2Cdisallow-untyped-defs%2Cno-implicit-reexport%2Clocal-partial-types%2Cwarn-redundant-casts%2Cwarn-return-any%2Cwarn-unreachable%2Cwarn-unused-configs%2Cwarn-unused-ignores&gist=b23d6734de352f6a0e635fa19fc5c58e)
**Crash Report** While I was having no problems with MyPy 1.10, with MyPy 1.11.0, 1.11.1 I get segmentation faults, and an exception with the code installed as: ``` pip3 install...
Fix: --install-types can mask failure details (#10768) (https://github.com/python/mypy/issues/10768)
It seems that: if the mypy cache dir wasn't created, this code would do an exit, preventing the actual errors from being printed. So I've removed the exit. More information...