python-trio / trio-typing

Type hints for Trio and related projects
Other
27 stars 14 forks source link

trio_typing 0.10.0 mypy plugin incompatible with mypy 1.11.2 #95

Open Hnasar opened 3 weeks ago

Hnasar commented 3 weeks ago

Mypy 1.11 changed some internal API and now TypeVars need a TypeVarId not just an int. See https://github.com/python/mypy/issues/17671

lib/python3.10/site-packages/trio-stubs/__init__.pyi:135: error: INTERNAL ERROR -- Please try using mypy master on GitHub:
https://mypy.readthedocs.io/en/stable/common_issues.html#using-a-development-mypy-build
Please report a bug at https://github.com/python/mypy/issues
version: 1.11.2
Traceback (most recent call last):
  File "mypy/checker.py", line 591, in accept
  File "mypy/nodes.py", line 929, in accept
  File "mypy/checker.py", line 5001, in visit_decorator
  File "mypy/checker.py", line 5028, in visit_decorator_inner
  File "mypy/checkexpr.py", line 1561, in check_call
  File "mypy/checkexpr.py", line 1803, in check_callable_call
  File "mypy/checkexpr.py", line 1241, in apply_function_plugin
  File "lib/python3.10/site-packages/trio_typing/plugin.py", line 464, in takes_callable_and_args_callback
    TypeVarType(
  File "mypy/types.py", line 604, in __init__
TypeError: mypy.types.TypeVarId object expected; got int
lib/python3.10/site-packages/trio-stubs/__init__.pyi:135: : note: use --pdb to drop into pdb
jakkdl commented 2 weeks ago

Note that trio-typing is mostly obsolete currently, with the main trio package having incorporated type hints. The only thing that trio-typing adds is typing of Nursery.start, see https://github.com/python-trio/trio-typing/issues/75#issuecomment-2189532972 I think the main package has better type hints in several cases, so I would recommend solely using it.