2 ms·
This is super interesting. How does async approaches work across different Python libraries? Are there any assumptions about usage of asyncio?
by miohtama 5y ago
This is super interesting. How does async approaches work across different Python libraries? Are there any assumptions about usage of asyncio?
- nerdponx 5y agoThe "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.