Repository navigation
Made PEP 747 (Annotating Type Forms) no longer experimental - #11302
Victorien (Viicos) wants to merge 1 commit into
Conversation
|
Diff from mypy_primer, showing the effect of this PR on open source code: bidict (https://github.com/jab/bidict)
+ .../projects/bidict/bidict/_typing.py:31:28 - error: Variable not allowed in type expression (reportInvalidTypeForm)
+ .../projects/bidict/bidict/_typing.py:31:28 - error: Type arguments for "Literal" must be None, a literal value (int, bool, str, or bytes), or an enum value (reportInvalidTypeForm)
- 12 errors, 2 warnings, 0 informations
+ 14 errors, 2 warnings, 0 informations
ibis (https://github.com/ibis-project/ibis)
+ .../projects/ibis/ibis/expr/datatypes/core.py:1062:23 - error: No parameter named "geotype" (reportCallIssue)
+ .../projects/ibis/ibis/expr/datatypes/core.py:1063:24 - error: No parameter named "geotype" (reportCallIssue)
- 7557 errors, 262 warnings, 0 informations
+ 7559 errors, 262 warnings, 0 informations
sympy (https://github.com/sympy/sympy)
+ .../projects/sympy/sympy/core/add.py:93:7 - error: Base classes for class "Add" define method "sort_key" in incompatible way
+ Return type mismatch: base method returns type "tuple[tuple[int, int, str], tuple[int, tuple[Unknown, ...]], tuple[tuple[Literal[1], Literal[0], Literal['Number']], tuple[int, tuple[()]], tuple[()], One], One]", override returns type "tuple[tuple[int, int, str], tuple[int, tuple[tuple[tuple[int, int, str], tuple[int, tuple[Unknown, ...]], tuple[tuple[Literal[1], Literal[0], Literal['Number']], tuple[int, tuple[()]], tuple[()], One], One] | Unknown | tuple[tuple[int, int, str | Unknown], tuple[int, tuple[Unknown, ...]] | tuple[int, tuple[str]], tuple[tuple[Literal[1], Literal[0], Literal['Number']], tuple[int, tuple[()]], tuple[()], One], One], ...]], tuple[tuple[Literal[1], Literal[0], Literal['Number']], tuple[int, tuple[()]], tuple[()], One] | Unknown, Number]"
+ "tuple[tuple[int, int, str], tuple[int, tuple[tuple[tuple[int, int, str], tuple[int, tuple[Unknown, ...]], tuple[tuple[Literal[1], Literal[0], Literal['Number']], tuple[int, tuple[()]], tuple[()], One], One] | Unknown | tuple[tuple[int, int, str | Unknown], tuple[int, tuple[Unknown, ...]] | tuple[int, tuple[str]], tuple[tuple[Literal[1], Literal[0], Literal['Number']], tuple[int, tuple[()]], tuple[()], One], One], ...]], tuple[tuple[Literal[1], Literal[0], Literal['Number']], tuple[int, tuple[()]], tuple[()], One] | Unknown, Number]" is not assignable to "tuple[tuple[int, int, str], tuple[int, tuple[Unknown, ...]], tuple[tuple[Literal[1], Literal[0], Literal['Number']], tuple[int, tuple[()]], tuple[()], One], One]"
+ Tuple entry 4 is incorrect type
+ "Number" is not assignable to "One" (reportIncompatibleMethodOverride)
- .../projects/sympy/sympy/core/cache.py:135:8 - error: "lower" is not a known attribute of "None" (reportOptionalMemberAccess)
- .../projects/sympy/sympy/core/cache.py:139:32 - error: Argument of type "str | Unknown | None" cannot be assigned to parameter "x" of type "ConvertibleToInt" in function "__new__"
- Type "str | Unknown | None" is not assignable to type "ConvertibleToInt"
- Type "None" is not assignable to type "ConvertibleToInt"
- "None" is not assignable to "str"
- "None" is incompatible with protocol "Buffer"
- "__buffer__" is not present
- "None" is incompatible with protocol "SupportsInt"
- "__int__" is not present
- "None" is incompatible with protocol "SupportsIndex"
- ... (reportArgumentType)
- .../projects/sympy/sympy/core/cache.py:139:32 - error: Argument of type "str | Unknown | None" cannot be assigned to parameter "x" of type "ConvertibleToInt" in function "__new__"
- Type "str | Unknown | None" is not assignable to type "ConvertibleToInt"
- Type "None" is not assignable to type "ConvertibleToInt"
- "None" is not assignable to "str"
- "None" is incompatible with protocol "Buffer"
- "__buffer__" is not present
- "None" is incompatible with protocol "SupportsInt"
- "__int__" is not present
- "None" is incompatible with protocol "SupportsIndex" (reportArgumentType)
+ .../projects/sympy/sympy/core/expr.py:167:9 - error: Method "sort_key" overrides class "Basic" in an incompatible manner
+ Return type mismatch: base method returns type "tuple[tuple[int, int, str], tuple[int, tuple[Unknown, ...]], tuple[tuple[Literal[1], Literal[0], Literal['Number']], tuple[int, tuple[()]], tuple[()], One], One]", override returns type "tuple[tuple[int, int, str], tuple[int, tuple[tuple[tuple[int, int, str], tuple[int, tuple[Unknown, ...]], tuple[tuple[Literal[1], Literal[0], Literal['Number']], tuple[int, tuple[()]], tuple[()], One], One] | Unknown | tuple[tuple[int, int, str | Unknown], tuple[int, tuple[Unknown, ...]] | tuple[int, tuple[str]], tuple[tuple[Literal[1], Literal[0], Literal['Number']], tuple[int, tuple[()]], tuple[()], One], One], ...]], tuple[tuple[Literal[1], Literal[0], Literal['Number']], tuple[int, tuple[()]], tuple[()], One] | Unknown, Number]"
+ "tuple[tuple[int, int, str], tuple[int, tuple[tuple[tuple[int, int, str], tuple[int, tuple[Unknown, ...]], tuple[tuple[Literal[1], Literal[0], Literal['Number']], tuple[int, tuple[()]], tuple[()], One], One] | Unknown | tuple[tuple[int, int, str | Unknown], tuple[int, tuple[Unknown, ...]] | tuple[int, tuple[str]], tuple[tuple[Literal[1], Literal[0], Literal['Number']], tuple[int, tuple[()]], tuple[()], One], One], ...]], tuple[tuple[Literal[1], Literal[0], Literal['Number']], tuple[int, tuple[()]], tuple[()], One] | Unknown, Number]" is not assignable to "tuple[tuple[int, int, str], tuple[int, tuple[Unknown, ...]], tuple[tuple[Literal[1], Literal[0], Literal['Number']], tuple[int, tuple[()]], tuple[()], One], One]"
+ Tuple entry 4 is incorrect type
+ "Number" is not assignable to "One" (reportIncompatibleMethodOverride)
+ .../projects/sympy/sympy/core/mul.py:95:7 - error: Base classes for class "Mul" define method "sort_key" in incompatible way
+ Return type mismatch: base method returns type "tuple[tuple[int, int, str], tuple[int, tuple[Unknown, ...]], tuple[tuple[Literal[1], Literal[0], Literal['Number']], tuple[int, tuple[()]], tuple[()], One], One]", override returns type "tuple[tuple[int, int, str], tuple[int, tuple[tuple[tuple[int, int, str], tuple[int, tuple[Unknown, ...]], tuple[tuple[Literal[1], Literal[0], Literal['Number']], tuple[int, tuple[()]], tuple[()], One], One] | Unknown | tuple[tuple[int, int, str | Unknown], tuple[int, tuple[Unknown, ...]] | tuple[int, tuple[str]], tuple[tuple[Literal[1], Literal[0], Literal['Number']], tuple[int, tuple[()]], tuple[()], One], One], ...]], tuple[tuple[Literal[1], Literal[0], Literal['Number']], tuple[int, tuple[()]], tuple[()], One] | Unknown, Number]"
+ "tuple[tuple[int, int, str], tuple[int, tuple[tuple[tuple[int, int, str], tuple[int, tuple[Unknown, ...]], tuple[tuple[Literal[1], Literal[0], Literal['Number']], tuple[int, tuple[()]], tuple[()], One], One] | Unknown | tuple[tuple[int, int, str | Unknown], tuple[int, tuple[Unknown, ...]] | tuple[int, tuple[str]], tuple[tuple[Literal[1], Literal[0], Literal['Number']], tuple[int, tuple[()]], tuple[()], One], One], ...]], tuple[tuple[Literal[1], Literal[0], Literal['Number']], tuple[int, tuple[()]], tuple[()], One] | Unknown, Number]" is not assignable to "tuple[tuple[int, int, str], tuple[int, tuple[Unknown, ...]], tuple[tuple[Literal[1], Literal[0], Literal['Number']], tuple[int, tuple[()]], tuple[()], One], One]"
+ Tuple entry 4 is incorrect type
+ "Number" is not assignable to "One" (reportIncompatibleMethodOverride)
- .../projects/sympy/sympy/discrete/convolutions.py
- .../projects/sympy/sympy/discrete/convolutions.py:368:13 - error: No overloads for "__setitem__" match the provided arguments (reportCallIssue)
- .../projects/sympy/sympy/discrete/convolutions.py:368:13 - error: Argument of type "Any | One | NegativeOne | Zero | Integer | NaN | ComplexInfinity | Rational | Infinity | NegativeInfinity | Float | Number | Expr" cannot be assigned to parameter "value" of type "Zero" in function "__setitem__"
- Type "Any | One | NegativeOne | Zero | Integer | NaN | ComplexInfinity | Rational | Infinity | NegativeInfinity | Float | Number | Expr" is not assignable to type "Zero"
- "Expr" is not assignable to "Zero" (reportArgumentType)
- .../projects/sympy/sympy/discrete/convolutions.py:371:9 - error: No overloads for "__setitem__" match the provided arguments (reportCallIssue)
- .../projects/sympy/sympy/discrete/convolutions.py:371:9 - error: Argument of type "Any | One | NegativeOne | Zero | Integer | NaN | ComplexInfinity | Rational | Infinity | NegativeInfinity | Float | Number | Expr" cannot be assigned to parameter "value" of type "Zero" in function "__setitem__"
- Type "Any | One | NegativeOne | Zero | Integer | NaN | ComplexInfinity | Rational | Infinity | NegativeInfinity | Float | Number | Expr" is not assignable to type "Zero"
- "Expr" is not assignable to "Zero" (reportArgumentType)
+ .../projects/sympy/sympy/functions/elementary/miscellaneous.py:380:7 - error: Base classes for class "MinMaxBase" define method "sort_key" in incompatible way
+ Return type mismatch: base method returns type "tuple[tuple[int, int, str], tuple[int, tuple[Unknown, ...]], tuple[tuple[Literal[1], Literal[0], Literal['Number']], tuple[int, tuple[()]], tuple[()], One], One]", override returns type "tuple[tuple[int, int, str], tuple[int, tuple[tuple[tuple[int, int, str], tuple[int, tuple[Unknown, ...]], tuple[tuple[Literal[1], Literal[0], Literal['Number']], tuple[int, tuple[()]], tuple[()], One], One] | Unknown | tuple[tuple[int, int, str | Unknown], tuple[int, tuple[Unknown, ...]] | tuple[int, tuple[str]], tuple[tuple[Literal[1], Literal[0], Literal['Number']], tuple[int, tuple[()]], tuple[()], One], One], ...]], tuple[tuple[Literal[1], Literal[0], Literal['Number']], tuple[int, tuple[()]], tuple[()], One] | Unknown, Number]"
+ "tuple[tuple[int, int, str], tuple[int, tuple[tuple[tuple[int, int, str], tuple[int, tuple[Unknown, ...]], tuple[tuple[Literal[1], Literal[0], Literal['Number']], tuple[int, tuple[()]], tuple[()], One], One] | Unknown | tuple[tuple[int, int, str | Unknown], tuple[int, tuple[Unknown, ...]] | tuple[int, tuple[str]], tuple[tuple[Literal[1], Literal[0], Literal['Number']], tuple[int, tuple[()]], tuple[()], One], One], ...]], tuple[tuple[Literal[1], Literal[0], Literal['Number']], tuple[int, tuple[()]], tuple[()], One] | Unknown, Number]" is not assignable to "tuple[tuple[int, int, str], tuple[int, tuple[Unknown, ...]], tuple[tuple[Literal[1], Literal[0], Literal['Number']], tuple[int, tuple[()]], tuple[()], One], One]"
+ Tuple entry 4 is incorrect type
... (truncated 417 lines) ...
prefect (https://github.com/PrefectHQ/prefect)
- .../projects/prefect/src/integrations/prefect-dask/tests/test_task_runners.py:104:31 - error: Argument of type "PrefectFuture[str]" cannot be assigned to parameter "b" of type "str" in function "submit"
- "PrefectFuture[str]" is not assignable to "str" (reportArgumentType)
+ .../projects/prefect/src/integrations/prefect-dask/tests/test_task_runners.py:103:24 - error: Cannot access attribute "submit" for class "FunctionType"
+ Attribute "submit" is unknown (reportFunctionMemberAccess)
+ .../projects/prefect/src/integrations/prefect-dask/tests/test_task_runners.py:104:17 - error: Type of "task_c" could not be determined because it refers to itself (reportGeneralTypeIssues)
- "str" is incompatible with protocol "Awaitable[_T_co@Awaitable]"
- "__await__" is not present (reportGeneralTypeIssues)
- .../projects/prefect/src/integrations/prefect-dask/tests/test_task_runners.py:110:22 - error: "str" is not awaitable
+ .../projects/prefect/src/integrations/prefect-dask/tests/test_task_runners.py:177:24 - error: Cannot access attribute "submit" for class "FunctionType"
+ Attribute "submit" is unknown (reportFunctionMemberAccess)
+ .../projects/prefect/src/integrations/prefect-dask/tests/test_task_runners.py:178:17 - error: Type of "task_c" could not be determined because it refers to itself (reportGeneralTypeIssues)
+ .../projects/prefect/src/integrations/prefect-dask/tests/test_task_runners.py:181:25 - error: Type of "test_flow" could not be determined because it refers to itself (reportGeneralTypeIssues)
+ .../projects/prefect/src/integrations/prefect-ray/tests/test_task_runners.py:220:24 - error: Cannot access attribute "submit" for class "FunctionType"
+ Attribute "submit" is unknown (reportFunctionMemberAccess)
+ .../projects/prefect/src/integrations/prefect-ray/tests/test_task_runners.py:221:17 - error: Type of "task_c" could not be determined because it refers to itself (reportGeneralTypeIssues)
+ .../projects/prefect/src/integrations/prefect-ray/tests/test_task_runners.py:224:19 - error: Type of "test_flow" could not be determined because it refers to itself (reportGeneralTypeIssues)
+ .../projects/prefect/src/integrations/prefect-ray/tests/test_task_runners.py:248:17 - error: Type of "task_c" could not be determined because it refers to itself (reportGeneralTypeIssues)
+ .../projects/prefect/src/integrations/prefect-ray/tests/test_task_runners.py:252:17 - error: Type of "test_flow" could not be determined because it refers to itself (reportGeneralTypeIssues)
- .../projects/prefect/src/integrations/prefect-ray/tests/test_task_runners.py:226:22 - error: "str" is not awaitable
- "str" is incompatible with protocol "Awaitable[_T_co@Awaitable]"
- "__await__" is not present (reportGeneralTypeIssues)
- .../projects/prefect/src/integrations/prefect-ray/tests/test_task_runners.py:255:24 - error: "tuple[PrefectFuture[NoReturn], PrefectFuture[NoReturn], PrefectFuture[Unknown], PrefectFuture[Unknown]]" is not awaitable
+ .../projects/prefect/src/integrations/prefect-ray/tests/test_task_runners.py:255:24 - error: "tuple[PrefectFuture[NoReturn], PrefectFuture[NoReturn], PrefectFuture[Unknown], Unknown]" is not awaitable
- "tuple[PrefectFuture[NoReturn], PrefectFuture[NoReturn], PrefectFuture[Unknown], PrefectFuture[Unknown]]" is incompatible with protocol "Awaitable[_T_co@Awaitable]"
+ "tuple[PrefectFuture[NoReturn], PrefectFuture[NoReturn], PrefectFuture[Unknown], Unknown]" is incompatible with protocol "Awaitable[_T_co@Awaitable]"
+ .../projects/prefect/src/integrations/prefect-ray/tests/test_task_runners.py:294:24 - error: Cannot access attribute "submit" for class "FunctionType"
+ Attribute "submit" is unknown (reportFunctionMemberAccess)
+ .../projects/prefect/src/integrations/prefect-ray/tests/test_task_runners.py:295:17 - error: Type of "task_c" could not be determined because it refers to itself (reportGeneralTypeIssues)
+ .../projects/prefect/src/integrations/prefect-ray/tests/test_task_runners.py:298:25 - error: Type of "test_flow" could not be determined because it refers to itself (reportGeneralTypeIssues)
- 5978 errors, 179 warnings, 0 informations
+ 5988 errors, 179 warnings, 0 informations
pip (https://github.com/pypa/pip)
+ .../projects/pip/src/pip/_vendor/rich/table.py
+ .../projects/pip/src/pip/_vendor/rich/table.py:939:13 - error: No parameter named "caption_justify" (reportCallIssue)
- 1107 errors, 31 warnings, 0 informations
+ 1108 errors, 31 warnings, 0 informations
static-frame (https://github.com/static-frame/static-frame)
+ .../projects/static-frame/static_frame/core/util.py:1044:32 - error: Attribute type cannot use type variable "TVFGItem@__init__" scoped to local method (reportGeneralTypeIssues)
- 58 errors, 71 warnings, 0 informations
+ 59 errors, 71 warnings, 0 informations
rich (https://github.com/Textualize/rich)
+ .../projects/rich/rich/table.py
+ .../projects/rich/rich/table.py:948:13 - error: No parameter named "caption_justify" (reportCallIssue)
- 369 errors, 43 warnings, 0 informations
+ 370 errors, 43 warnings, 0 informations
|
|
Victorien (@Viicos), it looks like the changes are causing a single test failure. |
|
Looks like a bug, that can be reproduce with the following MRE: from typing import NamedTuple
# X is necessary to reproduce. Doesn't reproduce with only "a" as a field
X = NamedTuple("X", [("a", int), ("b", str)])
X(1, "1")
class Z(NamedTuple):
c: list[str]
d: list[int]
q6 = Z(["1"], [3]) # Error: Class definition for "Z" depends on itself
# This is necessary to reproduce
for a, b in zip(*q6): # needs to be named a and b to reproduce
passLLM analysisThe The chain of events:
The reason both X and the zip call are needed:
The fix should restore the |
|
Closing as superseded by #11412 (Enable TypeForm support by default), merged on June 25, 2026. That change removed the TypeForm experimental gates and addressed the string-literal evaluation issue discussed here; current main also already includes the sentinel change. The remaining difference is the stale experimental label for PEP 747 in docs/features.md, which will be handled in a separate documentation-only PR. Thanks for the original contribution! |
as it was recently accepted: https://discuss.python.org/t/55984/103.