
⚙️ TonIO is an asynchronous runtime for Python built in Rust and designed for Python versions without the global interpreter lock (free-threaded). Its goal is to enable concurrent work across multiple CPU cores.
Unlike asyncio, TonIO supports two styles: generators with yield and the familiar async/await syntax. It includes tools for spawning tasks, waiting for results, running blocking operations in a thread pool, and coordinating work with events, locks, semaphores, and structured cancellation.
🚦 It can also process tasks as they finish, enforce timeouts, and schedule intervals. This makes it easier to build applications that perform multiple I/O operations without blocking the entire program.
⚠️ The project is still in alpha, works only on Unix systems and free-threaded Python, and is not directly compatible with asyncio objects.
💡 Explanation in a nutshell#
Imagine a kitchen with several cooks: instead of waiting for one dish to finish before starting another, TonIO coordinates multiple tasks and uses each thread efficiently. Rust provides a fast, safe foundation while Python keeps the API familiar.
More information at the link 👇
