Fastapi: [QUESTION] Trio - Python library for async concurrency and I/O

Created on 12 Jun 2019  路  6Comments  路  Source: tiangolo/fastapi

Description

Hello!
I'm using Hypercorn with uvloop.
I'd like to use Hypercorn with trio, but the program doesn't start when i switch uvloop by trio.

Do you have plans to implement trio?

Thank's!

PS: Nice work.

question

All 6 comments

I guess most FastAPI users use it with uvloop which trio is not compatible with: https://github.com/python-trio/trio/issues/138

Thanks for the help here @haizaar ! Nice investigation.

I think @haizaar is right, by checking that issue.

This is a great place to mention that you can use hypercorn, which seems to support trio (I haven't tested it personally though).

Maybe, again maybe, if you configure uvicorn to use asyncio instead of uvloop as its loop, trio will work with it and consequently, with FastAPI

Of course that's in case one does not need absolutely cutting edge performance.

So, FastAPI uses Starlette's run_in_threadpool internally, and that uses asyncio.

Prior to FastAPI supporting Trio, we would need Starlette itself to support Trio. But that's probably quite a lot of work there. Also, if Starlette supported Trio that would be automatically inherited by FastAPI.

You can track it here: https://github.com/encode/starlette/issues/811

Assuming the original issue was solved, it will be automatically closed now. But feel free to add more comments or create new issues.

Was this page helpful?
0 / 5 - 0 ratings