Doing asyncio looks simple at first, but can get very complicated when trying to build complex and robust programs, as there are a lot of pitfalls. On top of that Python's asyncio docs are not particularly great, somethings there are no clear guides on how to do things right, like cleanup and cancellation, what's a checkpoint or not, what guarantees are provided, etc.
On the other hand, trio, provides excellent documentation, so it would be nice to do something similar for asyncio, specifying what are the provided guarantees (if any), which functions are checkpoints, recommend how to review async code to make sure checkpoints are always provided, give recommendations on how to do common things, like cancellation, properly. We will probably need to provide helper functions to make complex tasks (like reliable catching a CancelledError after cancelling a task), simple. We can add those to the frequenz-core library.
Doing
asynciolooks simple at first, but can get very complicated when trying to build complex and robust programs, as there are a lot of pitfalls. On top of that Python'sasynciodocs are not particularly great, somethings there are no clear guides on how to do things right, like cleanup and cancellation, what's a checkpoint or not, what guarantees are provided, etc.On the other hand,
trio, provides excellent documentation, so it would be nice to do something similar forasyncio, specifying what are the provided guarantees (if any), which functions are checkpoints, recommend how to review async code to make sure checkpoints are always provided, give recommendations on how to do common things, like cancellation, properly. We will probably need to provide helper functions to make complex tasks (like reliable catching aCancelledErrorafter cancelling a task), simple. We can add those to thefrequenz-corelibrary.