Metadata-Version: 2.4
Name: code-sandbox-sdk
Version: 1.0.0
Summary: Python SDK for Code Sandbox API
Requires-Python: >=3.8
Description-Content-Type: text/markdown
Requires-Dist: httpx>=0.24.0
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"

# Code Sandbox Python SDK

Use the Code Sandbox API to run code in 10+ languages from Python.

## Install

```bash
pip install code-sandbox-sdk
```

Or from source in this repo:

```bash
pip install -e packages/python-sdk
```

## Usage

```python
from code_sandbox import Client

client = Client(api_key="your-api-key")

# Execute code
result = client.execute(language="python", code="print(2 + 2)")
print(result.stdout)   # 4
print(result.success)  # True
print(result.exit_code)  # 0

# List runtimes
for r in client.runtimes():
    print(r.language, r.version)
```

## API

- **Client(api_key, base_url=None)** – Create a client. `base_url` defaults to `http://localhost:3001`.
- **client.execute(language, code, stdin=None, version=None)** – Run code. Returns an **ExecuteResult** with `success`, `stdout`, `stderr`, `exit_code`, `run_time_ms`, `error`, `compile_output`.
- **client.runtimes()** – List supported languages and versions. Returns a list of **Runtime** objects with `language`, `version`, `aliases`.
