Asyncio Task Cancellation Best Practices
superfastpython.comanswer: use Trio (or AnyIO if you're stuck in the asyncio land) and get sane cancel mechanics built-in.
I love how C# came up with this a decade ago and everyone else is slowly catching on.
The language features are products of "reinventing the wheel processes" in general.