Note
Paving the way for Async: This release introduces support for async plugins and task loops! This is the first step toward the fully asynchronous refactor starting in the next major version. This will significantly improve performance and keep the main thread responsive without relying on heavy OS threads.
What's New:
Plugin Refactors:
The plugin architecture has been heavily refined to be more intuitive, safer, and feature-rich:
-
New Event System &
@app_eventDecorator: Event registration has been vastly cleaned up. You can now use the new@app_eventdecorator for a much more streamlined way to register app/custom events, replacing the legacy methods (e.gdef before_server_stop(...)) with the new decorator (e.g@app_event("before_server_start")) -
Async Plugin Support: Plugins now officially support
asyncevent methods, allowing you to perform non-blocking operations directly in your event hooks. This is the first step towards a full asynchronous refactor. -
Cancellable Events (
event.cancel(...)): Core operations can now be intercepted and cancelled by plugins. The newCancellableEventobject is injected intobeforehooks. Callingevent.cancel(reason)will short-circuit the core operation and return a cancellation payload. This is useful for scenarios where you want to cancel a start if a backup or update fails etc, etc. -
Periodic Background Tasks (
@task_loop): Plugins can now safely run periodic tasks. Using the lightweight@task_loop(interval_in_seconds)decorator on a plugin method will automatically schedule and run it, with thePluginManagerseamlessly handling startup and safe cancellation during unload. -
Topological Dependency Loading: The
PluginManagernow handles topological sorting of plugins. You can definedependenciesandoptional_dependenciesin your plugin attributes, ensuring they load in the correct order. -
Event Identity Keys & Re-entrancy Refactor: A runtime
_event_registryis now used for per-event identity keys, preventing infinite loops during event dispatches, removing the need for hardcoded app events. -
Auto-Generated Event Documentation: The
api_docs_generatorplugin has been extended to automatically generate markdown documentation for all available plugin events in the current app installation.
What's Changed
🚀 Features
- Feat/improved plugins by @DMedina559 in #400
💄 Style & Refactoring
- Refactor/app-start-up-init by @DMedina559 in #396
⬆️ Dependencies
- dep: update httpx2 requirement from <2.11,>=2.5.0 to >=2.5.0,<2.13 by @dependabot[bot] in #395
- dep: update mcstatus requirement from <14.1,>=12.0 to >=12.0,<14.2 by @dependabot[bot] in #393
- dep: update click requirement from <8.5,>=8.2.0 to >=8.2.0,<8.6 by @dependabot[bot] in #398
- dep: update isort requirement from <8.1,>=5.13.0 to >=5.13.0,<9.1 by @dependabot[bot] in #399
Full Changelog: 3.10.5...3.10.6