Opened 11 months ago

Closed 11 months ago

Last modified 10 months ago

#31852 closed New feature (needsinfo)

Support async generators in StreamingHttpResponse

Reported by: Axel Hecht Owned by: nobody
Component: HTTP handling Version: 3.1
Severity: Normal Keywords:
Cc: Andrew Godwin Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

The DEP for async menytions that async generators should be supported in StreamingHttpResponse.

After some digging, it seems that at least StreamingHttpResponse itself and ASGIHandler.send_response need changes to support that?

Change History (2)

comment:1 Changed 11 months ago by Carlton Gibson

Cc: Andrew Godwin added
Resolution: needsinfo
Status: newclosed
Type: UncategorizedNew feature

Yes, this is probably something we should take as a new feature, but it's a little undefined at the moment.

Can I point you to the Forum Async topic: https://forum.djangoproject.com/c/internals/async/8https://forum.djangoproject.com/c/internals/async/8
That's a good place to discuss it, and get fleshed out what would be required.

I'll cc Andrew, as maybe he already has thoughts.

comment:2 Changed 10 months ago by Andrew Godwin

We definitely should expand to add this, but async generators are quite tough to support across a range of Python versions; they get increasingly better to use every version. I think the best approach here would be an exploratory patch to see what we can get that looks reasonable given Django's current supported Python versions - 3.6 might be a high enough baseline (3.5 is very problematic), but it might be a thing that's easier in a future 3.7+ release.

Note: See TracTickets for help on using tickets.
Back to Top