Why anyio?¶
aiokpl is a library, not an application. Library users in the trio
ecosystem cannot adopt an asyncio-only library. anyio is the standard
portability layer between the two runtimes, so we depend on it and write
every public stage so it works on either backend.
Practical consequences:
- Locks, events, sleeps, task groups, cancel scopes are all the
anyioones, notasyncio's. - Every component that needs a background task (
ShardMaprefresh,Reducerdeadline timer,Limiterdrain loop) owns or receives ananyio.abc.TaskGroup. - The test suite parametrizes
anyio_backendacross["asyncio", "trio"]so each async test runs once per backend.