Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Curio's spiritual successor is Trio [1], which was written by one of the main Curio contributors and is more actively maintained (and, at this point, much more widely used). Like Curio, it's much easier to use than asyncio, although ideas from it are gradually being incorporated back into asyncio e.g. asyncio.run() was inspired by curio.run()/trio.run().

I have used Trio in real projects and I thoroughly recommend it.

This blog post [2] by the creator of Trio explains some of the benefits of those libraries in a very readable way.

[1] https://trio.readthedocs.io/en/stable/

[2] https://vorpus.org/blog/some-thoughts-on-asynchronous-api-de...



As yet another option, I really like Anyio, which is a "frontend" to either Asyncio or Trio, which provides a consistent and tidy API for what is known as "structured concurrency" (I think the name was popularized by the C library Dill).

https://anyio.readthedocs.io


This is super interesting. How does async approaches work across different Python libraries? Are there any assumptions about usage of asyncio?


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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: