mypy
mypy copied to clipboard
Optional static typing for Python
**Bug Report** Seeing this regression on mypy 1.16 with Enums of NamedTuples values. Note: Enums of plain classes or dataclasses work as expected. **To Reproduce** https://mypy-play.net/?mypy=1.16.0&python=3.13&flags=strict&gist=2c5d8ca22757aee67d917d8fec20ad7f ```python from enum import...
## Summary This PR introduces three key improvements to enhance the clarity and usefulness of Mypy's error messages related to missing type annotations. Worked on this as part of PyCon...
At our company we use mypy extensively on quite a large codebase. More often than not, after switching branches dmypy will crash, because it still expects an import of a...
Hello, I'm trying to write a plugin for my [paramclasses](https://github.com/eliegoudout/paramclasses) library. I already posted about it on [gitter](https://app.gitter.im/#/room/#python_typing:gitter.im) to ask a few questions (without answer at the moment). I'm still...
(Explain how this PR changes mypy.)
Consider the following code: ```python from dataclasses import dataclass @dataclass class Foo: value: int modified: bool = False def update(self) -> None: self.value += 1 self.modified = True foo =...
**Documentation** The docstring of these plugin hook methods currently say: https://github.com/python/mypy/blob/057508b4cb405fbc22e26b44f764b142352fcce5/mypy/plugin.py#L647-L648 ... https://github.com/python/mypy/blob/057508b4cb405fbc22e26b44f764b142352fcce5/mypy/plugin.py#L664 I understand this to mean that the argument to `fullname` will be `"__main__.Base.method"`, because `__main__.Base` defines `method`....
**Feature** [PEP 728](https://peps.python.org/pep-0728/) proposes changes to `TypedDict`, including the ability to specify the types of unspecified keys. This has been [implemented in `typing_extensions` with the `__extra_items__` keyword](https://typing-extensions.readthedocs.io/en/latest/index.html#typing_extensions.TypedDict.__extra_items__) since version 4.10....
Fixes #16975 Supersedes #16977 Allows `TypeVarTuple`s as type argument for subclasses of generic `TypedDict`s. Since (1) TypedDict became generic and (2) TypeVarTuple was introduced, mypy now supports creating generic typed...
This pull request contributes to issue #5917, which encourages the decomposition and simplification of overly long methods to improve code clarity and maintainability. ### Summary of changes Refactored the `infer_overload_return_type`...