app.engine.strategy_registry module¶
Explicit strategy registry.
Replaces the legacy filesystem-scan in
app.engine.all_engine_strategies. Strategy classes opt-in by
decorating themselves with register_strategy(). External packages
can contribute strategies via the game.strategies entry-point group
declared in their packaging metadata.
- app.engine.strategy_registry.register_strategy(id, *, version=None)[source]¶
Register a strategy class under a stable, public id.
The id is the value persisted on games and returned by the API, so it must remain stable across class renames or file moves.
- Parameters:
id (str) – Public identifier for the strategy (e.g.
"default").version (str | None) – Optional version string. When provided, it is also exposed as the
__strategy_version__class attribute.
- Raises:
ValueError – If
idis empty or another class is already registered under the same id.- Return type:
Callable[[T], T]
- app.engine.strategy_registry.registered_strategies()[source]¶
Return a snapshot of the registry as
{id: class}.- Return type:
dict[str, type]