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.",
            dependencies=[]
        )

    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.dev1.tar.gz (44.8 MB 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.dev1-py3-none-any.whl (65.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pumpkin_api_py-0.1.0.dev1.tar.gz
  • Upload date:
  • Size: 44.8 MB
  • 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.dev1.tar.gz
Algorithm Hash digest
SHA256 6202c3fc94928e6b2520a9fa90193f654260afc17a12875366dddef87b7b4fbd
MD5 daefb68bca36534885f504b9a885a896
BLAKE2b-256 945ccffeb01755f3056c64a1fd3418566484b0d4c94d0d20653230b8bdba34b2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pumpkin_api_py-0.1.0.dev1-py3-none-any.whl
Algorithm Hash digest
SHA256 b34375c646172e53cdb8f5fe87e90ca855b13fcf6710d338df75fc6c16624264
MD5 e97c8066aa55a7fb4df0a2b83582e353
BLAKE2b-256 c96b15ea86798cc671b6b92da47ae1435ec11f4b0230f7110a28bac79ad0c12e

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