Returning to Python full-stack development after a stint with Node, it seems like using async/await is not widely adopted enough in the Python ecosystem to actually use?<p>In no particular order<p>- Django doesn’t have an async ORM? (<a href="https://docs.djangoproject.com/en/5.0/topics/async/" rel="nofollow">https://docs.djangoproject.com/en/5.0/topics/async/</a>)<p>- Django Rest Framework has no async support? <a href="https://github.com/encode/django-rest-framework/issues/7260">https://github.com/encode/django-rest-framework/issues/7260</a><p>- SQLModel’s section on async support basically says “docs coming soon”? Yet this is designed to be used with FastAPI? Why would the docs not start with async/await? <a href="https://sqlmodel.tiangolo.com/advanced/" rel="nofollow">https://sqlmodel.tiangolo.com/advanced/</a><p>- SqlAlchemy/asyncpg => you can’t use it if you’re using PgBouncer (necessary most of the time with Postgres) in transaction mode? What?? <a href="https://github.com/MagicStack/asyncpg/issues/1058">https://github.com/MagicStack/asyncpg/issues/1058</a><p>- Ubiquitous “requests” library used in most docs examples, no async support <a href="https://github.com/psf/requests">https://github.com/psf/requests</a><p>- Top package for GitHub REST API, no async support <a href="https://github.com/PyGithub/PyGithub">https://github.com/PyGithub/PyGithub</a><p>- …on and on…<p>What’s the point of my nice FastAPI server if nothing internally can use async/await? How is everyone else doing this?<p>/rant
Personally I am fine doing python/Django fullstack without it and never felt the need to use async/await.<p>I was interested in the situation with the Django ORM however. The page you linked to seems somewhat contradictory. In the section on "Queries and the ORM" it seems that there are asynchronous versions for most queries that actually cause an SQL query:<p><a href="https://docs.djangoproject.com/en/5.0/topics/async/#queries-the-orm" rel="nofollow">https://docs.djangoproject.com/en/5.0/topics/async/#queries-...</a><p>These should also be fine to be executed in an async context, right? But then later in the section on async safety it somewhat seems like the ORM is totally prevented from being executed in an asynchronous manner:<p><a href="https://docs.djangoproject.com/en/5.0/topics/async/#async-safety" rel="nofollow">https://docs.djangoproject.com/en/5.0/topics/async/#async-sa...</a><p>The linked section on orm queries however makes it seem like it should be possible to use the Django ORM asynchronously if you only use the async methods (aget, aupdate, async for, ...) and watch out for some gotchas:<p><a href="https://docs.djangoproject.com/en/5.0/topics/db/queries/#async-queries" rel="nofollow">https://docs.djangoproject.com/en/5.0/topics/db/queries/#asy...</a>
Let me say that I'm of the opinion that async/await just became popular because js didn't have any better way of doing concurrent programming<p>Having one thread per worker sounds better. Or the actor model<p>Sure async/await is "easy" but also turns every code into a mess
I generally find threaded code easier to work with, especially with WSGI applications (one thread per request). The only time I find async code helpful is to prevent callback hell like when using PySide6 or JavaScript on the front-end.