mypy
mypy copied to clipboard
Optional static typing for Python
This makes `.value` not accidentally prune out one of its literals! Alternatively (I just realized this now) we could just return the type without `.last_known_value`. I can switch to that...
This makes the enum plugin (e.g. `.name` and `.value`) work on enum `Literal`s. Fixes https://github.com/python/mypy/issues/14092
```py from abc import ABC, abstractmethod from typing import overload class Foo(ABC): @overload # error: An overloaded function outside a stub file must have an implementation @abstractmethod def foo(self, value:...
**Feature** Allow ```python f: Callable[[int], int] def f(n): return 42 ``` as an alternative to ```python def f(n: int) -> int: return 42 ``` **Pitch** Currently, the proposed syntax produces...
**Crash Report** **Traceback** ``` main.py:3: error: Name "TypeVarTuple" is not defined [name-defined] main.py:4: error: Variable "__main__.Ts" is not valid as a type [valid-type] main.py:4: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases main.py:5: error: Bad...
_Note: make sure you run mypy with a cold cache each time if you're trying to repro this bug locally. It seems to not always reproduce if you have a...
_(An earlier version of this post used `TypeAnnotation` rather than `TypeForm` as the initially proposed spelling for the concept described here)_ **Feature** A new special form `TypeForm[T]` which is conceptually...
`--namespace-packages` runs into an issue if we import from `__init__.py` explicitly. For instance, given: ``` . └── proj ├── __init__.py └── a.py $ cat proj/__init__.py x: int $ cat proj/a.py...
Caching bug with `--incremental --cache-dir` combination causes `AssertionError: Cannot find module`
**Crash Report** There appears to be a caching bug in `mypy 1.2.0 (compiled: yes)`. This started occurring recently after we upgraded from `1.0.0` to `1.2.0`. I am running mypy with...
**Documentation** As far as I can tell from the docs/google searches/looking through github issues, there isn't guidance on the standard or simplest ways to run mypy in a monorepo of...