Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mypy 1.4.0 is not compatible with typing-extensions 3.10 version #15487

Closed
olgasentemova opened this issue Jun 21, 2023 · 3 comments · Fixed by #15488
Closed

mypy 1.4.0 is not compatible with typing-extensions 3.10 version #15487

olgasentemova opened this issue Jun 21, 2023 · 3 comments · Fixed by #15488
Labels
bug mypy got something wrong

Comments

@olgasentemova
Copy link

Bug Report

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
@olgasentemova olgasentemova added the bug mypy got something wrong label Jun 21, 2023
@cdce8p
Copy link
Collaborator

cdce8p commented Jun 21, 2023

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.

@cdce8p
Copy link
Collaborator

cdce8p commented 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
Copy link
Member

AlexWaygood commented Jun 21, 2023

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 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug mypy got something wrong
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants