Skip to main content

Python client for the Py-Ritone Baritone bridge

Project description

pyritone

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

Install

pip install pyritone

Beginner usage

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.

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:

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

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

Regenerate command wrappers/docs

python tools/generate_baritone_commands.py

End-to-End Dev Test

  1. Start Minecraft dev client from the mod folder:
cd ..\mod
.\gradlew.bat devClient
  1. Join a world.
  2. Run one of the example scripts:
cd ..\python
python example_sync.py
python example_async.py

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

pyritone-0.1.0.tar.gz (31.3 kB view details)

Uploaded Source

Built Distribution

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

pyritone-0.1.0-py3-none-any.whl (30.4 kB view details)

Uploaded Python 3

File details

Details for the file pyritone-0.1.0.tar.gz.

File metadata

  • Download URL: pyritone-0.1.0.tar.gz
  • Upload date:
  • Size: 31.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Hatch/1.16.3 cpython/3.13.3 HTTPX/0.28.1

File hashes

Hashes for pyritone-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b09e68b56ba771f72b17d923ceea09a213a70eecea6ef5ae62e3d95d06154fa5
MD5 afee321aa746b8bbc7c406c0a26b938d
BLAKE2b-256 8311d5b154ffdc89ea42a59ccad2e0511258405e27fd7116ddea5454d964fd97

See more details on using hashes here.

File details

Details for the file pyritone-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pyritone-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 30.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Hatch/1.16.3 cpython/3.13.3 HTTPX/0.28.1

File hashes

Hashes for pyritone-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2d29070d3887efe86299beffcefd87d57d315b45def16c7c4cfd7820ece8f041
MD5 9d6ad8a1d9d354b152bafd37a4a97350
BLAKE2b-256 2617e2ea39f0b39f40a82589277ae698887c11cfdcc54076a7f44e85132956df

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