Opened 4 years ago

Closed 4 years ago

Last modified 15 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 (4)

comment:1 by Carlton Gibson, 4 years ago

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 by Andrew Godwin, 4 years ago

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.

comment:3 by Tim Graham, 15 months ago

#34300 requested this again, pointing to an implementation at ​https://pypi.org/project/django-async-stream/.

comment:4 by Simon Charette, 15 months ago

Isn't this supported in 4.2 via (0bd2c0c9015b53c41394a1c0989afbfd94dc2830) #33735?

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