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

ModuleNotFoundError with typing_extensions on cattrs v23.2 and python 3.11+ #446

Closed
JWCook opened this issue Nov 17, 2023 · 0 comments · Fixed by #447
Closed

ModuleNotFoundError with typing_extensions on cattrs v23.2 and python 3.11+ #446

JWCook opened this issue Nov 17, 2023 · 0 comments · Fixed by #447

Comments

@JWCook
Copy link
Contributor

JWCook commented Nov 17, 2023

  • cattrs version: 23.2.0
  • Python version: 3.11
  • Operating System: Ubuntu 22.04

Description

It looks like typing_extensions is imported here unconditionally, but the version constraint here only installs it for python < 3.11.

What I Did

In a fresh virtualenv with python 3.11+:

python -m pip install cattrs

Run the first example from the readme:

import cattrs

cattrs.structure([1.0, 2, "3"], tuple[int, int, int])

Traceback:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "~/.virtualenvs/cattrs/lib/python3.11/site-packages/cattrs/__init__.py", line 1, in <module>
    from .converters import BaseConverter, Converter, GenConverter, UnstructureStrategy
  File "~/.virtualenvs/cattrs/lib/python3.11/site-packages/cattrs/converters.py", line 58, in <module>
    from .dispatch import HookFactory, MultiStrategyDispatch, StructureHook, UnstructureHook
  File "~/.virtualenvs/cattrs/lib/python3.11/site-packages/cattrs/dispatch.py", line 5, in <module>
    from typing_extensions import TypeAlias
ModuleNotFoundError: No module named 'typing_extensions'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant