Skip to content

Conversation

CoolCat467
Copy link
Contributor

@CoolCat467 CoolCat467 commented Dec 23, 2024

In this pull request, we fix the typing for what is allowed to be used as a response type, allowing responses to be AsyncIterable[str] or AsyncIterable[bytes].

Flask sans-io is used by Quart

Through a huge chain of things, this pull request fixes #5322, because pallets/quart#341 doesn't actually fix the root issue unfortunately.

@davidism davidism added this to the 3.1.1 milestone Mar 29, 2025
@davidism
Copy link
Member

I don't think this is correct either, since Flask views can't return async iterables.

@davidism
Copy link
Member

I guess I'll merge it, the type is still checked at runtime. In Quart returning a WSGIApplication isn't valid either (I think?), so it's already not completely accurate. We could always extend Flask's async support to handle async iterables, or make the typing take advantage of generics more as suggested by @pgjones in the previous issue.

@davidism davidism changed the base branch from main to stable March 29, 2025 22:07
@davidism davidism merged commit e785166 into pallets:stable Mar 30, 2025
13 checks passed
@CoolCat467 CoolCat467 deleted the AsyncIterable-response branch March 31, 2025 02:46
CoolCat467 added a commit to CoolCat467/Scanner-Server that referenced this pull request Mar 31, 2025
pallets/flask#5659 just got merged fixing the typing issues, but they haven't made a release yet so use the repo directly until that happens
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 15, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ResponseValue Typing issue
2 participants