You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
mypy 1.4.0 is not compatible with typing-extensions 3.10 version #15487
mypy 1.4.0 is not compatible with typing-extensions 3.10 version.
To Reproduce
Install mypy 1.4.0 on an environment where typing_extensions library has a 3.10 version
Python version is used 3.11
pip3 show typing_extensions
Name: typing-extensions
Version: 3.10.0.2
Summary: Backported and Experimental Type Hints for Python 3.5+
Home-page: https://github.com/python/typing/blob/master/typing_extensions/README.rst
Author: Guido van Rossum, Jukka Lehtosalo, Łukasz Langa, Michael Lee
Author-email: [email protected]
License: PSF
Location: /usr/local/lib/python3.11/site-packages
Requires:
Required-by: mypy
pip3 list | grep mypy
mypy 1.4.0
mypy-extensions 1.0.0
run mypy . Expected Behavior
mypy starts and runs the analysis
Actual Behavior
mypy .
Traceback (most recent call last):
File "/usr/local/bin/mypy", line 5, in <module>
from mypy.__main__ import console_entry
File "/usr/local/lib/python3.11/site-packages/mypy/__main__.py", line 9, in <module>
from mypy.main import main, process_options
File "mypy/main.py", line 14, in <module>
File "mypy/build.py", line 47, in <module>
File "mypy/semanal_main.py", line 35, in <module>
File "mypy/checker.py", line 27, in <module>
File "mypy/checkexpr.py", line 13, in <module>
File "mypy/applytype.py", line 5, in <module>
File "mypy/subtypes.py", line 8, in <module>
File "mypy/constraints.py", line 9, in <module>
File "mypy/typeops.py", line 13, in <module>
File "mypy/copytype.py", line 5, in <module>
File "mypy/types.py", line 20, in <module>
def f():
ImportError: cannot import name 'Self' from 'typing_extensions' (/usr/local/lib/python3.11/site-packages/typing_extensions.py)
Your Environment
Mypy version used: 1.4.0.
Mypy command-line flags: none
Mypy configuration options from mypy.ini (and other config files): none
Python version used: Python 3.11.4 (main, Jun 15 2023, 07:29:58) [Clang 14.0.3 (clang-1403.0.22.14.1)] on darwin
Yeah. Mypy started using Self which is only available in typing_extensions>=4.0.0. I'll open a PR shortly to bump the requirement. In the meantime, you can update typing_extensions manually.
Just a heads up. We just discovered another new import. You'll need to use at least version 4.1.0.
(The import in question is is_typeddict, which is new in typing_extensions 4.1.0 -- we import is_typeddict in mypy/stubtest.py. But the is_typeddict import in stubtest has actually been there for a while, I think -- the reason it's never come up before now is probably because only a subset of mypy users are stubtest users :)
Activity
cdce8p commentedon Jun 21, 2023
Yeah. Mypy started using
Selfwhich is only available intyping_extensions>=4.0.0. I'll open a PR shortly to bump the requirement. In the meantime, you can updatetyping_extensionsmanually.cdce8p commentedon Jun 21, 2023
Just a heads up. We just discovered another new import. You'll need to use at least version
4.1.0.AlexWaygood commentedon Jun 21, 2023
(The import in question is
is_typeddict, which is new in typing_extensions 4.1.0 -- we importis_typeddictinmypy/stubtest.py. But theis_typeddictimport in stubtest has actually been there for a while, I think -- the reason it's never come up before now is probably because only a subset of mypy users are stubtest users :)