mypy
mypy copied to clipboard
Optional static typing for Python
**Crash Report** unfortunately I have not been able to narrow this down further -- but will include a full reproduction ```bash rm -rf sentry git init -q sentry cd sentry...
**Feature** Unreachability should be checked for constrained type vars. **Pitch** It would be nice if this raised an error when run with `--warn-unreachable`: ```py from typing import TypeVar U =...
**Bug Report** If a generic type variable `_E` has an upper bound `B`, the upper bound `B` seems to be used as the inferred type of `_E` when inferring other...
[playground](https://mypy-play.net/?mypy=latest&python=3.12&flags=warn-unreachable&gist=1c452f6b04bd81cd40ad25bbfc8e614b) ```python from typing import Any, Callable from typing_extensions import TypeIs, assert_type, assert_never def is_single_callable(c: Callable[[], Any] | Callable[[int], Any]) -> TypeIs[Callable[[int], Any]]: ... def test(c: Callable[[], Any] | Callable[[int],...
``` from typing_extensions import Any, TypeIs, reveal_type class C[T]: v: T def is_int(v: object) -> TypeIs[C[int]]: ... def f(c: C[Any]): if is_int(c): reveal_type(c) reveal_type(c) # should be C[Any], but is...
**Documentation** mypy 1.15 does not have a dependency on python package `pathspec` but mypy 1.16 does. Is this something you usually document (in release notes?) or somewhere else?
When I add `exclude_gitignore = true` to the `[tool.mypy]` in the `pyproject.toml` of [numtype](https://github.com/numpy/numtype), stubtest suddenly fails to find the `numpy-stubs`, while `mypy` itself still seems to works. This also...
**Feature** I frequently see people new to python typing _over_ typing everything -- think `x: int = function_that_obviously_returns_int()`. I would like this to be an optional error **Pitch** in most...
```python class A(metaclass=abc.ABCMeta): pass class B: pass A.register(B) a: A = B() # currently E: Incompatible types in assignment (expression has type "B", variable has type "A") print(isinstance(a, A)) #...
**Bug Report** When stubgen creates stubs for a module that imports `Incomplete` , it then mangles / overcomplicates the import in the generated stub edit : On Windows **To Reproduce...