Re:A viable solution for Python concurrency
by miohtama on Friday October 15, 2021 @07:37PM
(#28884339)
This is super interesting. How does async approaches work across different Python libraries? Are there any assumptions about usage of asyncio?
[ Parent
| on HN ]
Re:A viable solution for Python concurrency
by nerdponx on Friday October 15, 2021 @07:50PM
(#28884402)
The "async/await" syntax is agnostic of the underlying async library, but Asyncio and Trio provide incompatible async "primitives". So yes, you need to write your code for one or the other, or use Anyio, which is a common layer over both.
Many more libraries use Asyncio than Trio, so I have come to recommend Anyio (which has a Trio-like API) but with Asyncio as the backend. That gives you the extensive Asyncio ecosystem but with the structured concurrency design of Trio.