mangum icon indicating copy to clipboard operation
mangum copied to clipboard

Trio support

Open jordaneremieff opened this issue 5 years ago • 4 comments

So I admittedly don't know how much may be involved here, but my initial thoughts are that including support for ASGI applications using Trio wouldn't require too much to implement as an adapter here.

jordaneremieff avatar Jan 28 '19 13:01 jordaneremieff

So... The only place you're using asyncio is for a single Queue instance. For trio, you'd need to swap that out with a trio Queue implementation instead.

The ASGI interface itself is agnostic - it's an async/await interface, rather than specifically being an asyncio interface.

(Broader context, Trio is obviously a huge step forwards, but I'm personally lukewarm on the ecosystem split it requires vs. bringing the learnings it introduces into asyncio.)

tomchristie avatar Jan 28 '19 14:01 tomchristie

@tomchristie Hm, interesting point about the broader context. I haven't really delved into Trio too deeply, but I've only heard good things about it and have seen various efforts to use it with ASGI.

That said, I don't have any particular interest in using it myself. I'm going to leave this as a "maybe" and won't likely do anything further, but if there are enough people that would find an ASGI Trio adapter useful I would be open to a PR.

jordaneremieff avatar Jan 28 '19 15:01 jordaneremieff

Codewise I think it just needs a trivial change to use trio.Event() in mangum/asgi/protocol.py (Tho I'm not sure how best you'd expose that as a switch.) Anyways, leaving this here, for someone else to make progress on if it ends up being a requirement for someone, somewhere

tomchristie avatar Jan 28 '19 15:01 tomchristie

Starlette is considering support for Trio here and that would make at least two frameworks that support Trio (Quart being the other) - might be worth including here.

jordaneremieff avatar Feb 07 '20 12:02 jordaneremieff