app.engine.all_engine_strategies module¶
Strategy enumeration backed by the explicit registry.
The legacy implementation walked app/engine with os.listdir()
(CWD-dependent), imported every module, picked classes by “first letter
uppercase”, and mutated the list while iterating. It also could not load
strategies from external packages.
This module now:
Auto-discovers every module inside the
app.enginepackage usingpkgutil.iter_modules()against the package’s resolved__path__(independent of the current working directory), so newly added strategy files are picked up without editing this file.Imports each module, which triggers
@register_strategyand registers the class inapp.engine.strategy_registry. Modules that don’t register anything (helpers, base classes) simply contribute nothing.Returns instances of every class currently in the registry. Third-party strategies declared via the
game.strategiesentry point are loaded lazily by the registry.
- app.engine.all_engine_strategies.all_engine_strategies()[source]¶
Return instances of every registered, validated strategy class.
Each instance has an
idattribute set to the registered strategy id (the public identifier persisted on games and exposed by the API).- Returns:
List of strategy instances, one per registered class. Classes that fail
check_class_methods_and_variables()are skipped.- Return type:
list