Metadata-Version: 2.4
Name: one-ring-loop
Version: 0.2.0
Summary: Custom async event loop built on io_uring with structured concurrency, file/socket IO, and timers
Project-URL: Homepage, https://github.com/otto-sellerstam/one-ring
Project-URL: Repository, https://github.com/otto-sellerstam/one-ring
Project-URL: Issues, https://github.com/otto-sellerstam/one-ring/issues
Author-email: Otto Sellerstam <ottosellerstam@gmail.com>
License: MIT
Keywords: async,coroutines,event-loop,io_uring,linux
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: System :: Networking
Classifier: Typing :: Typed
Requires-Python: >=3.14
Requires-Dist: one-ring-core>=0.1.0
Requires-Dist: structlog>=24.0
Description-Content-Type: text/markdown

# one-ring-loop

Custom async event loop built on [one-ring-core](https://pypi.org/project/one-ring-core/) and Linux io_uring.

Part of the [one-ring](https://github.com/otto-sellerstam/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

```python
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

```bash
uv add one-ring-loop
```

## License

MIT
