Aiotools v1.0.0 release with virtual clock for asyncio

I have been writing and using a small library called aiotools since 2017, and I gave a talk about this in PyCon KR 2017.
Finally, I just released v1.0.0!

The main motivation behind aiotools is to reduce boiler-plate asyncio codes used throughout my company projects, namely, Backend.AI, and make them well-tested.
The most frequently used feature is the server API, which hides many gory details about spawning multi-process asyncio event loops with graceful termination. I often combine it with aiohttp and reuse_port=True.

A new feature in v1.0 is the virtual clock for asyncio.
While migration the test suite to GitHub Actions, macOS environments has caused frequent failures of the timer test cases due to flakky sleep durations.
I could not find existing implementations of virtual clock on asyncio (e.g., nolar/kopf#212) and so built one as aiotools.timer.VirtualClock, which simply overrides _selector.select() and time() methods (hence it only works on UNIX-like platforms).
It makes tests based on asyncio.sleep() deterministic and instantly completed, like what freezegun offers for synchronous timing codes and trio does for its testing.

Another major feature in v1.0 is the inclusion of a draft implementation of TaskGroup API, which is adopted from EdgeDB Python client library. A special thanks to @yselivanov.
I’m just wondering if there are any progress on adoption of it in the standard library.

Please have a look and give me comments/feedbacks.

ps. There are potential contribution points for those intereseted: documentation with richer examples, and making the server test suite working on GitHub Actions (signal handling issue).

ps. I’m not sure if it’s okay to “advertise” my open source library related to asyncio here. Please let me know if there are better places.

4 Likes