Metadata-Version: 2.4
Name: runtimed
Version: 0.1.5a202603050550
Requires-Dist: mcp>=1.26.0
Requires-Dist: httpx>=0.27.0,<1.0
Requires-Dist: pyzmq>=25.0 ; extra == 'bridge'
Requires-Dist: ipykernel>=6.0 ; extra == 'kernel'
Provides-Extra: bridge
Provides-Extra: kernel
Summary: Python toolkit for Jupyter runtimes, powered by runtimed Rust binaries
Author-email: Kyle Kelley <rgbkrk@gmail.com>
License-Expression: BSD-3-Clause
Requires-Python: >=3.10
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM

# runtimed

Python bindings for the runtimed notebook daemon. Execute code, manage kernels, and interact with notebooks programmatically.

## Installation

```bash
pip install runtimed
```

## Quick Start

### Synchronous API

```python
import runtimed

with runtimed.Session() as session:
    session.start_kernel()
    result = session.run("print('hello')")
    print(result.stdout)  # "hello\n"
```

### Async API

```python
import asyncio
import runtimed

async def main():
    async with runtimed.AsyncSession() as session:
        await session.start_kernel()
        result = await session.run("print('hello async')")
        print(result.stdout)

asyncio.run(main())
```

## Features

- **Code execution** via daemon-managed kernels
- **Sync and async APIs** for flexibility
- **Document-first model** with automerge sync
- **Multi-client support** for shared notebooks
- **Rich output capture** (stdout, stderr, display_data, errors)

## Session API

```python
session = runtimed.Session(notebook_id="my-notebook")
session.start_kernel()

# Simple execution
result = session.run("x = 42")

# Document-first pattern (for fine-grained control)
cell_id = session.create_cell("print(x)")
result = session.execute_cell(cell_id)

# Inspect results
print(result.success)
print(result.stdout)
print(result.error)
```

## AsyncSession API

```python
async with runtimed.AsyncSession(notebook_id="my-notebook") as session:
    await session.start_kernel()
    result = await session.run("x = 42")

    # Or document-first pattern
    cell_id = await session.create_cell("print(x)")
    result = await session.execute_cell(cell_id)
```

## DaemonClient API

```python
client = runtimed.DaemonClient()
client.ping()        # Health check
client.status()      # Pool statistics
client.list_rooms()  # Active notebooks
```

## Requirements

- runtimed daemon running (`runt daemon start`)
- Python 3.9+

## Documentation

See [docs/python-bindings.md](https://github.com/nteract/desktop/blob/main/docs/python-bindings.md) for full documentation.

