mypy
mypy copied to clipboard
Optional static typing for Python
**Bug Report, To Reproduce, & Expected Behaviour** An error occurs when defining a constrained type variable where the default is a `TypedDict` type. See [mypy Playground](https://mypy-play.net/?mypy=latest&python=3.12&gist=5bfa0a22c6118254603305812fa175ca): ```python import typing as...
I noticed this behavior when investigating a [similar issue in pyright](https://github.com/microsoft/pyright/issues/8554). Mypy isn't correctly narrowing tuples in some cases. ```python from typing_extensions import TypeIs def is_tuple_of_strings(v: tuple[int | str, ...])...
**Feature** Similar to setting MYPYPATH: Allow setting mypy’s config file location with an environment variable, e.g.: `$ export MYPYCFG=~/work/settings/mypy.ini` **Pitch** Most, if not all, of my Python projects use the...
These tests (`testForIterable`, `testYieldNested`) consistently fail on my machine. I suspect this is because some output is printed to stdout and some to stderr. Since the streams are not synchronized...
**Feature** I would like to be able to have a way to say `foo: datetime` but know that `foo` either: - definitely doesn't have a tzinfo - has a tzinfo...
**Preamble** - This issue may already exists but I was unable to find an exact match. There are plenty of issues related to the PEP 604 syntax but none that...
**Crash Report** Validating of my python module causes "INTERNAL ERROR" **Traceback** version: 1.11.1 Traceback (most recent call last): File "/home/sizov/Documents/root/venv/bin/mypy", line 8, in sys.exit(console_entry()) File "mypy/build.py", line 2069, in wrap_context...
**Feature** I would like to request an enhancement in mypy to allow it to infer TypeVar bounds from assert issubclass(...) statements. Currently, mypy uses such assertions for local type refinement...
Closes #11463 Closes https://github.com/python/mypy/issues/11495 Recreate of https://github.com/python/mypy/pull/11496
Closes https://github.com/python/mypy/issues/17579 Consider this as a prototype, because I understand that there might be a lot of extra work to get this right. However, this does solve this problem in...