Custom async event loop built on io_uring with structured concurrency, file/socket IO, and timers
Project description
one-ring-loop
Custom async event loop built on one-ring-core and Linux io_uring.
Part of the one-ring project.
What it provides
- Task scheduling with
TaskandTaskGroup(structured concurrency) - File IO - async file operations via io_uring
- Socket IO - TCP server/client with
create_server,Connection.receive/send - Timers - async
sleepbacked by io_uring timeouts - Streams - buffered byte streams, TLS wrapping, memory streams
- Cancellation -
move_on_after/fail_afterscoped timeout/cancellation
Example
from one_ring_loop import TaskGroup, run
from one_ring_loop.socketio import Connection, create_server
def echo_handler(conn):
try:
while True:
data = yield from conn.receive(1024)
if not data:
break
yield from conn.send(b"Echo: " + data)
finally:
yield from conn.close()
def main():
server = yield from create_server(b"0.0.0.0", 9999)
tg = TaskGroup()
tg.enter()
try:
while True:
conn = yield from server.accept()
tg.create_task(echo_handler(conn))
finally:
yield from tg.exit()
yield from server.close()
run(main())
Requirements
- Linux with io_uring support (kernel 6.7+)
- Python 3.14+
Installation
uv add one-ring-loop
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
one_ring_loop-0.2.0.tar.gz
(20.3 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file one_ring_loop-0.2.0.tar.gz.
File metadata
- Download URL: one_ring_loop-0.2.0.tar.gz
- Upload date:
- Size: 20.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.8 {"installer":{"name":"uv","version":"0.10.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"25.10","id":"questing","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4182c6a57afcfda8076f663ed8f3c97b3fa1420ff5049d9e0a0ac7b3a47a269f
|
|
| MD5 |
671f5f7872d5c0cd7f2157b1250deb81
|
|
| BLAKE2b-256 |
7460702c7f534c849a74a19fc901785ba51726d8c685d42c4dd902e9737ff424
|
File details
Details for the file one_ring_loop-0.2.0-py3-none-any.whl.
File metadata
- Download URL: one_ring_loop-0.2.0-py3-none-any.whl
- Upload date:
- Size: 23.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.8 {"installer":{"name":"uv","version":"0.10.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"25.10","id":"questing","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6b9dd333886df107890c746fac87a97baa8a01e53a678d01abae72b8125510bd
|
|
| MD5 |
b1cb3307989f844ff861c91c4ca28512
|
|
| BLAKE2b-256 |
0d5b4fc3b9148dd8ede57c66855834ac3b49a36a9d8cd60a9663690709a38fb0
|