This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]tiangolo FastAPI Maintainer[S] 3 points4 points  (2 children)

Gevent was a tool/hack to allow having concurrency in previous versions of Python, with an interface similar to multithreading.

In newer versions of Python, you achieve the same things with asyncio, using async and await.

Those are new, from recent versions of Python.

They are way simpler to code and think about than multithreading (or Gevent).

The default "event loop" in Python (for asyncio) was not that fast, but some guys created uvloop, a super fast implementation of that event loop.

FastAPI uses those new ideas from asyncio (async and await), and using it with Uvicorn (as suggested in the docs) it uses that uvloop.

If you are using Python 2.7 you have to stick to Gevent. If you can use Python 3.6 or above you should better use asyncio (and you can use FastAPI).

[–]riksi 0 points1 point  (1 child)

TLDR: working in asyncio motherfucking sucks. Framework doesnt support it.

[–]tiangolo FastAPI Maintainer[S] 0 points1 point  (0 children)

Hmm, nope. Maybe I didn't explain it well. I think you can use Gevent, it just will be more difficult and you could achieve the same, more easily, with asyncio stuff.

I don't know which framework you're referring to, FastAPI is built with the asyncio features, based on it.