Skip to main content

Pumpkin plugin API for Python

Project description

Pumpkin Plugin API for Python

This package provides everything needed to write a Pumpkin server plugin compiled to WebAssembly using Python.

Quick start

  1. Install pumpkin-api-py:
pip install pumpkin-api-py
  1. Create your plugin (main.py):
from pumpkin_api import (
    Plugin, PluginMetadata, register_plugin, 
    server, event, command, text, context
)

class MyPlugin(Plugin):
    def metadata(self) -> PluginMetadata:
        return PluginMetadata(
            name="my-plugin",
            version="0.1.0",
            authors=["you"],
            description="An example plugin."
        )

    def on_load(self, ctx: context.Context) -> None:
        print("Python plugin loaded!")
        
        # Register an event handler
        self.register_event(ctx, event.EventType.PLAYER_JOIN_EVENT, self.on_player_join)

    def on_player_join(self, srv: server.Server, evt: event.PlayerJoinEventData) -> event.PlayerJoinEventData:
        print(f"Player {evt.player.get_name()} joined!")
        return evt

register_plugin(MyPlugin)
  1. Build your plugin into a WebAssembly component:
pumpkin-api-build main -o my_plugin.wasm

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

pumpkin_api_py-0.1.0.dev0.tar.gz (64.5 kB view details)

Uploaded Source

Built Distribution

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

pumpkin_api_py-0.1.0.dev0-py3-none-any.whl (95.4 kB view details)

Uploaded Python 3

File details

Details for the file pumpkin_api_py-0.1.0.dev0.tar.gz.

File metadata

  • Download URL: pumpkin_api_py-0.1.0.dev0.tar.gz
  • Upload date:
  • Size: 64.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for pumpkin_api_py-0.1.0.dev0.tar.gz
Algorithm Hash digest
SHA256 efe7bcd15aab2b883c31a292f0d507d18fa4e161d2a79417f5e6710c625ea73b
MD5 f2f508ea83e807a69b645bb9136d0adc
BLAKE2b-256 063af62e640517e2b67e6b0891ff8d3134596e5a15cba7ad286bf3e7ea7e2634

See more details on using hashes here.

File details

Details for the file pumpkin_api_py-0.1.0.dev0-py3-none-any.whl.

File metadata

File hashes

Hashes for pumpkin_api_py-0.1.0.dev0-py3-none-any.whl
Algorithm Hash digest
SHA256 2dbcf13131a09059a80f3f156ce365953039d4b88a6cc283ed210be3f7fd8817
MD5 a820975537365aed1be77dbadfdee84d
BLAKE2b-256 f428e8c47d451e6de6bb93fcb3e8727d03713d7b850ffddb374f89a8356e1433

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