-
-
Notifications
You must be signed in to change notification settings - Fork 845
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
Use more permissible types in ASGIApp #3109
Conversation
41121f2
to
dd3f99c
Compare
Yep. Seems reasonable enough... possibly worth a |
57cb35e
to
f1581bb
Compare
MutableMapping is a slightly more permissible type (allowing the previous Dict type) but matches up to Starlettes tpyes
changelog added! |
Thanks, let's get this in. |
Just curious when this gets shipped into a version. Couldn't find any info on that. Meanwhile I'll be using the deprecated |
* Use the type.MutableMapping instead of Dict MutableMapping is a slightly more permissible type (allowing the previous Dict type) but matches up to Starlettes tpyes * Update CHANGELOG.md --------- Co-authored-by: Tom Christie <tom@tomchristie.com>
Is there any plan to release this change soon? Still getting hit with deprecation warnings, but if we update then |
Closes #3111
MutableMapping and Awaitable are slightly more permissible types (I think, as they allow the previous Dict and Coroutine types) but more importantly they match up to Starlettes tpyes
Summary
Hello! When upgrading to the latest version of Httpx we found that our test client was producing types errors (but fine at run time), we use FastAPI which is Starlette under the hood:
AsyncClient(transport=ASGITransport(app=app), base_url="http://test")
This might be a bug in pylance not understanding the nested mutable mappings and their compatibililty with dicts, but this change makes httpx more flexible with other ASGI apps, and matches for example Starlette's ASGI app types: https://github.com/encode/starlette/blob/7533b61a34f8b0dcb5fc35c717d458439f0baf18/starlette/types.py#L10
So the consistency might be worth it?
Checklist