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
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=Nonecreated_at=<Date2020-10-12.10:17:09.694>labels= ['type-feature', 'library']
title='typing support in wsgiref'updated_at=<Date2022-04-05.15:22:18.750>user='https://github.com/srittau'
In typeshed (the repository for stdlib type annotations), we have defined a bunch of types to support annotating WSGI interfaces. See https://github.com/python/typeshed/blob/master/stdlib/2and3/_typeshed/wsgi.pyi for the current version. Unfortunately these types are only available at type check time, which means that users need to do some gymnastics to use them in their own code.
I think it would be worthwhile to add these types directly to wsgiref or to a new module (e.g. wsgiref.types). On the one hand users could use them at runtime easily, on the other hand they serve as additional documentation WSGI types. In my experience, WSGI applications and middleware often slightly misimplement the standard, which can make interoperability difficult. Both type checking and concrete documentation could help alleviate this problem.
If the maintainers think this would be a good idea, I could provide a PR for both the types and the Python documentation.
Activity
srittau commentedon Oct 12, 2020
In typeshed (the repository for stdlib type annotations), we have defined a bunch of types to support annotating WSGI interfaces. See https://github.com/python/typeshed/blob/master/stdlib/2and3/_typeshed/wsgi.pyi for the current version. Unfortunately these types are only available at type check time, which means that users need to do some gymnastics to use them in their own code.
I think it would be worthwhile to add these types directly to wsgiref or to a new module (e.g. wsgiref.types). On the one hand users could use them at runtime easily, on the other hand they serve as additional documentation WSGI types. In my experience, WSGI applications and middleware often slightly misimplement the standard, which can make interoperability difficult. Both type checking and concrete documentation could help alleviate this problem.
If the maintainers think this would be a good idea, I could provide a PR for both the types and the Python documentation.
JelleZijlstra commentedon Apr 4, 2022
This seems useful to me but I don't have experience with wsgiref. pje is listed as the maintainer in the devguide but appears to be inactive.
I'd suggest you open a PR and if anyone feels strongly against it, they can complain.
gh-86178: Add wsgiref.types (GH-32335)
gh-86178: wsgiref.types: Add missing TypeAlias annotations (GH-91608)
kumaraditya303 commentedon Apr 20, 2022
Closing as the associated PR is merged and types are added now.