Metadata-Version: 2.4
Name: pyritone
Version: 0.1.1
Summary: Python client for the Py-Ritone Baritone bridge
Project-URL: Homepage, https://github.com/GSstarGamer/Py-Ritone
Project-URL: Repository, https://github.com/GSstarGamer/Py-Ritone
Author: Py-Ritone
License: MIT
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Requires-Python: >=3.10
Provides-Extra: test
Requires-Dist: pytest-asyncio>=0.23; extra == 'test'
Requires-Dist: pytest>=8.0; extra == 'test'
Description-Content-Type: text/markdown

# pyritone

`pyritone` is the Python client for the Py-Ritone Fabric bridge.

## Install

```bash
pip install pyritone
```

## Beginner usage

```python
from pyritone import PyritoneClient

with PyritoneClient() as client:
    dispatch = client.goto(100, 70, 100)
    task_id = dispatch.get("task_id")
    if task_id:
        terminal = client.wait_for_task(task_id)
        print(terminal["event"])
```

## Command API

All top-level Baritone v1.15.0 commands are exposed as Python methods on:

- `PyritoneClient` (sync)
- `AsyncPyritoneClient` (async)

Each command returns immediate dispatch info:

- `command_text`
- `raw` bridge response
- optional `task_id`
- optional `accepted`

Command aliases are exposed too (`qmark`, `stop`, `wp`, etc). Full generated reference:

- `python/docs/baritone-commands.md`

## Settings API

You can control Baritone settings through a settings namespace.

```python
from pyritone import PyritoneClient

with PyritoneClient() as client:
    client.settings.allowSprint = True
    client.settings.allowBreak = False

    print(client.settings.allowSprint.get())
    print(client.settings.allowSprint.toggle())
    print(client.settings.allowSprint.reset())
```

Async style:

```python
from pyritone import AsyncPyritoneClient

client = AsyncPyritoneClient()
await client.connect()
try:
    await client.settings.allowSprint.set(True)
    await client.settings.allowSprint.get()
finally:
    await client.close()
```

## Low-level API still available

- `execute("...")`
- `cancel()`
- `ping()`
- `status_get()`
- `next_event()`
- `wait_for_task(task_id)`

## Zero-setup discovery

By default, `pyritone` discovers bridge details from:

- `<minecraft>/config/pyritone_bridge/bridge-info.json`

Override priority:

1. Explicit constructor args
2. Environment variables (`PYRITONE_BRIDGE_INFO`, `PYRITONE_TOKEN`, `PYRITONE_HOST`, `PYRITONE_PORT`)
3. Default bridge info file

## CLI

```bash
pyritone ping
pyritone status
pyritone exec "goto 100 70 100"
pyritone cancel
pyritone events
```

## Regenerate command wrappers/docs

```bash
python tools/generate_baritone_commands.py
```

## End-to-End Dev Test

1. Start Minecraft dev client from the mod folder:

```powershell
cd ..\mod
.\gradlew.bat devClient
```

2. Join a world.
3. Run one of the example scripts:

```powershell
cd ..\python
python example_sync.py
python example_async.py
```
