Skip to main content

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 Task and TaskGroup (structured concurrency)
  • File IO - async file operations via io_uring
  • Socket IO - TCP server/client with create_server, Connection.receive/send
  • Timers - async sleep backed by io_uring timeouts
  • Streams - buffered byte streams, TLS wrapping, memory streams
  • Cancellation - move_on_after/fail_after scoped 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


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.1.tar.gz (20.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

one_ring_loop-0.2.1-py3-none-any.whl (23.5 kB view details)

Uploaded Python 3

File details

Details for the file one_ring_loop-0.2.1.tar.gz.

File metadata

  • Download URL: one_ring_loop-0.2.1.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

Hashes for one_ring_loop-0.2.1.tar.gz
Algorithm Hash digest
SHA256 9d397662af80a72875e9ed2d14c6131504717fdf2fc28b193f5fd979f0391202
MD5 f9a069139f040f20585f078050aa9f02
BLAKE2b-256 30fc6c17f28b2b8b8086b2af312d0a84df6110f5db543c503fce9b7292343a74

See more details on using hashes here.

File details

Details for the file one_ring_loop-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: one_ring_loop-0.2.1-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

Hashes for one_ring_loop-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2ffa693b7bc6c1bb8b91a759fc3d65be93bcb09b325e8274a8be2bd80666171b
MD5 e8e69609afb6851816ceea531471bbab
BLAKE2b-256 ff4303a1b56d254895288dd1313558fc24cf2b5e81a58196366f65c109854ec2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page