Skip to content

Commit 98edb2a

Browse files
committed
Initial Py-Ritone monorepo scaffold
0 parents  commit 98edb2a

51 files changed

Lines changed: 3654 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.editorconfig

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
insert_final_newline = true
7+
trim_trailing_whitespace = true
8+
9+
[*.{java,py,md,json,toml,yml,yaml,properties,gradle}]
10+
indent_style = space
11+
indent_size = 4
12+
13+
[*.{gradle,properties,json,yml,yaml,toml}]
14+
indent_size = 2
15+
16+
[Makefile]
17+
indent_style = tab

.github/workflows/ci.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: ["main"]
6+
pull_request:
7+
8+
jobs:
9+
mod-build:
10+
runs-on: windows-latest
11+
defaults:
12+
run:
13+
shell: pwsh
14+
steps:
15+
- uses: actions/checkout@v4
16+
- name: Set up Java 21
17+
uses: actions/setup-java@v4
18+
with:
19+
distribution: temurin
20+
java-version: "21"
21+
- name: Build Fabric mod
22+
working-directory: mod
23+
run: .\gradlew.bat build --no-daemon
24+
- name: Upload mod artifact
25+
uses: actions/upload-artifact@v4
26+
with:
27+
name: pyritone-mod-jar
28+
path: mod/build/libs/*.jar
29+
30+
python-test:
31+
runs-on: ubuntu-latest
32+
steps:
33+
- uses: actions/checkout@v4
34+
- name: Set up Python
35+
uses: actions/setup-python@v5
36+
with:
37+
python-version: "3.13"
38+
- name: Install dependencies
39+
working-directory: python
40+
run: |
41+
python -m pip install --upgrade pip
42+
python -m pip install pytest build twine
43+
- name: Run tests
44+
working-directory: python
45+
run: python -m pytest
46+
- name: Build package
47+
working-directory: python
48+
run: python -m build
49+
- name: Twine check
50+
working-directory: python
51+
run: python -m twine check dist/*
52+
- name: Upload python artifacts
53+
uses: actions/upload-artifact@v4
54+
with:
55+
name: pyritone-python-dist
56+
path: python/dist/*
57+
58+
protocol-lint:
59+
runs-on: ubuntu-latest
60+
steps:
61+
- uses: actions/checkout@v4
62+
- name: Validate protocol schema JSON
63+
run: python -m json.tool protocol/bridge-protocol-v1.schema.json > /dev/null
64+
- name: Ensure protocol doc exists
65+
run: test -f protocol/bridge-protocol-v1.md

.gitignore

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Root
2+
.git/
3+
4+
# OS
5+
.DS_Store
6+
Thumbs.db
7+
8+
# IDE
9+
.idea/
10+
.vscode/
11+
*.iml
12+
13+
# Python
14+
__pycache__/
15+
*.py[cod]
16+
*.egg-info/
17+
.pytest_cache/
18+
.venv/
19+
venv/
20+
python/dist/
21+
python/build/
22+
23+
# Gradle/Fabric
24+
mod/.gradle/
25+
mod/build/
26+
mod/run/
27+
28+
# Runtime logs
29+
mod/logs/

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2026 Py-Ritone
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Py-Ritone
2+
3+
Py-Ritone is a zero-setup local bridge between a Fabric Minecraft client (with Baritone installed) and Python.
4+
5+
## Monorepo Layout
6+
7+
- `mod/`: Fabric client mod (`pyritone_bridge`) exposing a local NDJSON socket bridge.
8+
- `python/`: PyPI-ready package (`pyritone`) with async client, sync wrapper, and CLI.
9+
- `protocol/`: Versioned bridge protocol docs and JSON schema.
10+
- `docs/`: Developer setup and runbook.
11+
12+
## Quick Start
13+
14+
1. Install Minecraft Fabric client for 1.21.8.
15+
2. Install Baritone `v1.15.0` mod.
16+
3. Build or install `pyritone_bridge` mod jar into your client mods folder.
17+
4. Install Python package:
18+
19+
```bash
20+
pip install pyritone
21+
```
22+
23+
5. Start Minecraft client. Py-Ritone opens `127.0.0.1:27841` automatically.
24+
6. Use the package:
25+
26+
```python
27+
from pyritone import PyritoneClient
28+
29+
with PyritoneClient() as client:
30+
print(client.ping())
31+
print(client.status_get())
32+
print(client.execute("goto 100 70 100"))
33+
```
34+
35+
## One-Click Dev Client
36+
37+
- Double-click `run_dev_client.bat` at repo root, or run it in terminal:
38+
39+
```powershell
40+
.\run_dev_client.bat
41+
```
42+
43+
- In VS Code, use the task button:
44+
- `Terminal` -> `Run Build Task` -> `Py-Ritone: Build and Run Dev Client`
45+
46+
This compiles and starts the Fabric dev client, and auto-downloads Baritone for dev runtime.
47+
48+
## Security Model (v1)
49+
50+
- Bridge binds to loopback only.
51+
- Auth token is generated by the mod and written to:
52+
- `<minecraft>/config/pyritone_bridge/bridge-info.json`
53+
- Python auto-discovers this file by default.
54+
55+
## License
56+
57+
MIT

docs/dev-setup.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Developer Setup
2+
3+
## Requirements
4+
5+
- Java 21+ (build targets Java 21 bytecode)
6+
- Python 3.10+
7+
- Git
8+
9+
## Build Fabric Mod
10+
11+
```powershell
12+
cd mod
13+
.\gradlew.bat build
14+
```
15+
16+
Output jar:
17+
18+
- `mod/build/libs/pyritone_bridge-<version>.jar`
19+
20+
## Run Python Tests
21+
22+
```powershell
23+
cd python
24+
python -m pytest
25+
```
26+
27+
## Build Python Package
28+
29+
```powershell
30+
cd python
31+
python -m build
32+
python -m twine check dist/*
33+
```
34+
35+
## Local End-to-End Smoke
36+
37+
1. Install Baritone `v1.15.0` and Py-Ritone mod jar in your Fabric client `mods` folder.
38+
2. Start Minecraft client and join a world.
39+
3. From Python:
40+
41+
```python
42+
from pyritone import PyritoneClient
43+
44+
with PyritoneClient() as client:
45+
print(client.ping())
46+
print(client.status_get())
47+
```

docs/runbook.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Runbook
2+
3+
## Bridge Not Starting
4+
5+
- Check Minecraft client logs for `pyritone_bridge` startup errors.
6+
- Ensure no process is already using `127.0.0.1:27841`.
7+
8+
## Python Client Cannot Connect
9+
10+
- Confirm Minecraft has started with both mods installed.
11+
- Confirm bridge file exists:
12+
- `%APPDATA%\.minecraft\config\pyritone_bridge\bridge-info.json`
13+
- Use explicit options for troubleshooting:
14+
15+
```bash
16+
pyritone --host 127.0.0.1 --port 27841 --token <token> ping
17+
```
18+
19+
## Unauthorized Errors
20+
21+
- Token mismatch between Python side and bridge info file.
22+
- Restart Minecraft client to regenerate/update bridge metadata.
23+
24+
## Baritone Unavailable
25+
26+
- Baritone mod is missing or wrong version.
27+
- Install `baritone-api-fabric-1.15.0.jar`.
28+
29+
## Not In World
30+
31+
- Connect to any singleplayer or multiplayer world before running `baritone.execute`.

0 commit comments

Comments
 (0)