Uh oh!
There was an error while loading. Please reload this page.
Use more permissible types in ASGIApp - #3109
Merged
Merged
Conversation
jonfinertyforce-pushed
the
patch-1
branch
4 times, most recently
from
February 22, 2024 09:34
41121f2 to
dd3f99cComparelovelydinosaur
approved these changes
Feb 22, 2024
lovelydinosaur
commented
Feb 22, 2024
Contributor
Yep. Seems reasonable enough... possibly worth a |
jonfinertyforce-pushed
the
patch-1
branch
2 times, most recently
from
February 22, 2024 15:51
57cb35e to
f1581bbCompareMutableMapping is a slightly more permissible type (allowing the previous Dict type) but matches up to Starlettes tpyes
jonfinerty
commented
Feb 22, 2024
ContributorAuthor
changelog added! |
Uh oh!
There was an error while loading. Please reload this page.
lovelydinosaur
approved these changes
Feb 23, 2024
lovelydinosaur
commented
Feb 23, 2024
Contributor
Thanks, let's get this in. |
antonwnk
commented
Feb 27, 2024
Just curious when this gets shipped into a version. Couldn't find any info on that. Meanwhile I'll be using the deprecated |
3 tasks
shepilov-vladislav pushed a commit
to shepilov-vladislav/httpx
that referenced
this pull request
Mar 28, 2024
* 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>
jamestrousdale
commented
Jul 25, 2024
Is there any plan to release this change soon? Still getting hit with deprecation warnings, but if we update then |
Merged
samclearman pushed a commit
to titanmsp/httpx
that referenced
this pull request
Apr 26, 2025
* 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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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