a2wsgi icon indicating copy to clipboard operation
a2wsgi copied to clipboard

a2wsgi needs typing_extensions on older Python versions

Open encukou opened this issue 2 months ago • 1 comments

Hello, Thank you for a2wsgi! I found a packaging issue on Python 3.10 and lower:

asgi_typing.py has:

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

However, typing_extensions is not listed as a runtime requirement. If a2wsgi is installed without its test dependencies, it fails to import:

$ pip install a2wsgi
[...]
Successfully installed a2wsgi-1.10.4

$ python
Python 3.8.19 (default, Mar 20 2024, 00:00:00) 
[GCC 13.2.1 20240316 (Red Hat 13.2.1-7)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import a2wsgi
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File ".../python3.8/site-packages/a2wsgi/__init__.py", line 1, in <module>
    from .asgi import ASGIMiddleware
  File ".../python3.8/site-packages/a2wsgi/asgi.py", line 9, in <module>
    from .asgi_typing import HTTPScope, ASGIApp, ReceiveEvent, SendEvent
  File ".../python3.8/site-packages/a2wsgi/asgi_typing.py", line 21, in <module>
    from typing_extensions import NotRequired
ModuleNotFoundError: No module named 'typing_extensions'
>>> 

encukou avatar Apr 23 '24 15:04 encukou