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.1.0.tar.gz
(19.4 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.1.0.tar.gz.
File metadata
- Download URL: one_ring_loop-0.1.0.tar.gz
- Upload date:
- Size: 19.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.17 {"installer":{"name":"uv","version":"0.9.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","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 |
ae9644676eb3273dc0f00120c39891f08f57d76aa1a12b90dacf456d6f564e0c
|
|
| MD5 |
c1b386f8dd9a834127b5d0e0c5994cbb
|
|
| BLAKE2b-256 |
d4849572c8045a98ed1746d50ab542975cc1619f7c3b6fb76991899c771a0dce
|
File details
Details for the file one_ring_loop-0.1.0-py3-none-any.whl.
File metadata
- Download URL: one_ring_loop-0.1.0-py3-none-any.whl
- Upload date:
- Size: 22.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.17 {"installer":{"name":"uv","version":"0.9.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","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 |
2075b34c03b946f7134b35c5ae9159cb22e2edc6a69f9d993f3f523adc34b91f
|
|
| MD5 |
8b1bd1dac3837efbfe52e47486c4b9d1
|
|
| BLAKE2b-256 |
ee9af946cde0d617d4837c80036d2fbb7783c58ed478f4576c7c2bd0b55ba79c
|