Skip to content

python<3.11: ModuleNotFoundError: No module named 'typing_extensions' #1150

@alexandervaneck

Description

@alexandervaneck

Recently this import was introduced and released in version 2.12.0.

from typing_extensions import Never

if sys.version_info >= (3, 11):
    from typing import Never
else:
    from typing_extensions import Never

However, typing_extensions is not listed as a dependency and thus this fails during runtime.

Could we please fix this? 🙏

Expected Result

The runtime should load for python<3.11

Actual Result

ModuleNotFoundError: No module named 'typing_extensions'

Reproduction Steps

$ uv venv --python 3.10
Using CPython 3.10.19
Creating virtual environment at: .venv
Activate with: source .venv/bin/activate
$ uv pip install PyJWT
Resolved 1 package in 1.36s
Prepared 1 package in 274ms
Installed 1 package in 7ms
 + pyjwt==2.12.0
$ uv run python -c "import jwt"
Traceback (most recent call last):
  File "/Users/alexander.vaneck/Projects/Paige/.venv/lib/python3.10/site-packages/jwt/algorithms.py", line 36, in <module>
    from cryptography.exceptions import InvalidSignature, UnsupportedAlgorithm
ModuleNotFoundError: No module named 'cryptography'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Users/alexander.vaneck/Projects/Paige/.venv/lib/python3.10/site-packages/jwt/__init__.py", line 1, in <module>
    from .api_jwk import PyJWK, PyJWKSet
  File "/Users/alexander.vaneck/Projects/Paige/.venv/lib/python3.10/site-packages/jwt/api_jwk.py", line 8, in <module>
    from .algorithms import get_default_algorithms, has_crypto, requires_cryptography
  File "/Users/alexander.vaneck/Projects/Paige/.venv/lib/python3.10/site-packages/jwt/algorithms.py", line 113, in <module>
    from typing_extensions import Never
ModuleNotFoundError: No module named 'typing_extensions'

System Information

$ python -m jwt.help

Does not run.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions