Package Python projects as Minecraft Bukkit plugins using GraalPy
Project description
Toomo ๐ โ ๐ฎ
Write Minecraft Bukkit plugins in Python. Zero Java required.
Toomo lets you write Bukkit/Spigot/Paper plugins using pure Python, powered by GraalPy (GraalVM's Python runtime). Define event handlers with decorators, register commands, and access the full Bukkit API โ all without touching a single line of Java.
from toomo import ToomoPlugin, on_event, on_command
from toomo.events import PLAYER_JOIN, PLAYER_QUIT
class MyPlugin(ToomoPlugin):
def on_enable(self):
self.logger.info("Hello from Python!")
@on_event(PLAYER_JOIN)
def on_join(self, event):
player = event.getPlayer()
player.sendMessage(f"Welcome, {player.getName()}!")
@on_command("hello")
def hello(self, sender, cmd, label, args):
sender.sendMessage("Hello from Python!")
return True
How It Works
Your Python code โโโ toomo build โโโ plugin.jar
โ
โโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโ
โ Java Bootstrap (auto-generated) โ
โ GraalPy Runtime (bundled) โ
โ Bukkit Bindings (auto-wired) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
- You write Python using toomo's decorators and bindings
toomo buildcompiles a thin Java bootstrap + bundles your Python- Drop the JAR into your server's
plugins/folder - Server runs GraalVM โ Python executes natively on the JVM
Quick Start
Prerequisites
- Development machine: Python 3.11+, uv
- Minecraft server: GraalVM JDK 23+ with GraalPy
Install toomo
pip install toomo
# or
uv tool install toomo
Create a plugin
toomo init MyFirstPlugin
cd MyFirstPlugin
This creates:
MyFirstPlugin/
โโโ toomo.toml # Plugin configuration
โโโ plugin.py # Your plugin code
โโโ .gitignore
Configure
Edit toomo.toml:
[plugin]
name = "MyFirstPlugin"
version = "1.0.0"
api_version = "1.21"
main = "plugin"
description = "My first Python Bukkit plugin"
[[commands]]
name = "hello"
description = "Says hello"
usage = "/hello"
[[permissions]]
name = "myplugin.use"
description = "Allows using myplugin"
default = "true"
Build
toomo build
Output: build/MyFirstPlugin-1.0.0.jar
Deploy
- Make sure your Minecraft server runs on GraalVM JDK 23+
- Copy the JAR to your server's
plugins/folder - Start/restart the server
Configuration Reference
toomo.toml
| Section | Key | Type | Description |
|---|---|---|---|
[plugin] |
name |
string | Plugin name |
[plugin] |
version |
string | Plugin version |
[plugin] |
api_version |
string | Bukkit API version (e.g., "1.21") |
[plugin] |
main |
string | Python module name (default: "plugin") |
[plugin] |
description |
string | Plugin description |
[[commands]] |
name |
string | Command name (without /) |
[[commands]] |
description |
string | Command description |
[[commands]] |
usage |
string | Usage hint |
[[commands]] |
aliases |
string[] | Command aliases |
[[commands]] |
permission |
string | Required permission |
[[permissions]] |
name |
string | Permission node |
[[permissions]] |
description |
string | Permission description |
[[permissions]] |
default |
string | Default value (true/false/op) |
depend |
string[] | Hard dependencies | |
soft_depend |
string[] | Soft dependencies |
API Reference
ToomoPlugin
Base class for all plugins. Provides:
| Method/Property | Description |
|---|---|
on_enable() |
Called when plugin loads |
on_disable() |
Called when plugin unloads |
.logger |
Java Logger instance |
.server |
Bukkit Server instance |
.name |
Plugin name |
.data_folder |
Plugin data directory |
.get_config() |
Get config.yml |
.save_config() |
Save default config |
.save_resource(path) |
Extract resource from JAR |
Event Decorator
@on_event('org.bukkit.event.player.PlayerJoinEvent')
def handler(self, event):
# event is a Bukkit Event object โ use Java methods directly
player = event.getPlayer()
Common events available as constants in toomo.events:
| Constant | Event |
|---|---|
PLAYER_JOIN |
PlayerJoinEvent |
PLAYER_QUIT |
PlayerQuitEvent |
PLAYER_CHAT |
AsyncPlayerChatEvent |
PLAYER_MOVE |
PlayerMoveEvent |
PLAYER_DEATH |
PlayerDeathEvent |
BLOCK_BREAK |
BlockBreakEvent |
BLOCK_PLACE |
BlockPlaceEvent |
ENTITY_DAMAGE |
EntityDamageEvent |
| ... | (80+ event constants) |
Command Decorator
@on_command('commandname')
def handler(self, sender, command, label, args):
# sender: CommandSender (Player or ConsoleCommandSender)
# command: Command object
# label: string used to invoke the command
# args: list of strings
return True # Return True to indicate success
Bukkit Interop
Access any Bukkit/Java class directly via GraalPy:
# From within your plugin methods:
Bukkit = java.type('org.bukkit.Bukkit')
worlds = Bukkit.getWorlds()
Material = java.type('org.bukkit.Material')
diamond = Material.DIAMOND
# Or use the convenience wrapper:
from toomo import bukkit
bukkit.Bukkit.broadcastMessage("Hello!")
Requirements
Development
- Python 3.11+
- uv (recommended)
Server
- GraalVM JDK 23+ with GraalPy
# Install GraalVM + GraalPy gu install python
- Paper/Spigot server for Minecraft 1.21+
Why GraalPy?
GraalPy runs Python code directly on the JVM with full access to Java classes and libraries. This means your Python plugin can interact with the Bukkit API as if it were native Java โ no bridges, no RPC, no performance penalty.
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file toomo-0.1.0.tar.gz.
File metadata
- Download URL: toomo-0.1.0.tar.gz
- Upload date:
- Size: 20.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.14 {"installer":{"name":"uv","version":"0.11.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"20.04","id":"focal","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f3095e1d0f25f23e24e6ceb7c95ddf8dbc485558f017989d6998af88b79e554c
|
|
| MD5 |
5842c1950f01a9ef110cb906b93e67ac
|
|
| BLAKE2b-256 |
62866280f3a880fb00c1178c546a15a7504e3585a18da211bee5bffd61c6f754
|
File details
Details for the file toomo-0.1.0-py3-none-any.whl.
File metadata
- Download URL: toomo-0.1.0-py3-none-any.whl
- Upload date:
- Size: 20.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.14 {"installer":{"name":"uv","version":"0.11.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"20.04","id":"focal","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2715e039fac12531cd7dd17c6ef7e5af8a00d381abf1a4edf28c13154880842a
|
|
| MD5 |
82f02857489bfd594126535c0677569e
|
|
| BLAKE2b-256 |
c8eeb1ae0cbf6dde11651185610a844de1a8f1614d479477e3128ba86f915c63
|