Support asyncio/Trio through AnyIO
davidbrochart opened this issue · comments
I was wondering if hypercorn could have asyncio/Trio compatibility using AnyIO, instead of having a different code base for asyncio and Trio?
Probably, however I prefer this setup.
I'm investigating this idea in https://github.com/davidbrochart/anycorn.
Happy to hand it over to you or send a PR to Hypercorn if you change you mind.
Probably, however I prefer this setup.
That's unfortunate. AnyIO provides the task_status
mechanism for both AsyncIO and Trio. Which allow us to write:
async with anyio.create_task_group() as group:
binds = await group.start(serve, asgi_app, config)
# ASGI server is started, and we have the binds
Whereas, with AsyncIO, we have (to my understanding) no way of "waiting until ASGI server is started", and no way of getting the actual binds. At least, no documented way.
If we want this feature, this forces us to use trio, which then prevents us from using any other AsyncIO libraries (like aiopg for example).