mini_arcade.modules.system_lab ============================== .. py:module:: mini_arcade.modules.system_lab .. autoapi-nested-parse:: Registry-backed isolated system runner for development. Submodules ---------- .. toctree:: :maxdepth: 1 /autoapi/mini_arcade/modules/system_lab/commands/index /autoapi/mini_arcade/modules/system_lab/processors/index /autoapi/mini_arcade/modules/system_lab/registry/index /autoapi/mini_arcade/modules/system_lab/visual_runner/index Classes ------- .. autoapisummary:: mini_arcade.modules.system_lab.SystemLabCommand mini_arcade.modules.system_lab.BaseSystemLabCase mini_arcade.modules.system_lab.SystemLabRegistry mini_arcade.modules.system_lab.SystemLabVisualSpec Package Contents ---------------- .. py:class:: SystemLabCommand Bases: :py:obj:`mini_arcade.cli.base_command.BaseCommand` Base class for all commands. Registration is done via the implementation decorator: @CommandRegistry.implementation("build") class Build(BaseCommand): ... or: from .command_registry import CommandRegistry @CommandRegistry.implementation("build") class Build(BaseCommand): ... Subclasses should implement the execute(...) method as the main entrypoint. :ivar name: Optional[str]: Command name (for registry); defaults to class name lowercased. :ivar aliases: Tuple[str, ...]: Optional command aliases. :ivar summary: Optional[str]: Short description of the command. :ivar epilog: Optional[str]: Additional help text for the command. :ivar args: Optional[List[ArgumentType]]: List of command arguments. :ivar abstract: bool: If True, the command is not registered (base class for shared logic); defaults to False. :ivar processor: Optional[BaseCommandProcessor]: The processor associated with this command. .. py:attribute:: name :value: 'system-lab' .. py:attribute:: aliases :value: ('run-system',) .. py:attribute:: args .. py:attribute:: __doc__ :value: Multiline-String .. raw:: html
Show Value .. code-block:: python """ List or run isolated system lab cases. Usage: mini-arcade system-lab --module my_game.debug.system_lab --list mini-arcade system-lab --module my_game.debug.system_lab --case ship_move --steps 3 mini-arcade system-lab --module my_game.debug.system_lab --visual --backend native """ .. raw:: html
.. py:method:: validate(**kwargs) Optional argument validation hook. .. py:class:: BaseSystemLabCase Bases: :py:obj:`abc.ABC` Contract for one isolated system run scenario. .. py:attribute:: visual_title :type: str :value: 'System Lab' .. py:attribute:: visual_scene_id :type: str :value: 'system_lab_visual' .. py:attribute:: visual_fps :type: int :value: 60 .. py:attribute:: visual_virtual_resolution :type: tuple[int, int] :value: (800, 600) .. py:attribute:: visual_window_size :type: tuple[int, int] | None :value: None .. py:attribute:: visual_background_color :type: tuple[int, int, int] :value: (14, 14, 20) .. py:attribute:: visual_backend_provider :type: str :value: 'pygame' .. py:attribute:: visual_controls_scene_key :type: str | None :value: None .. py:attribute:: visual_input_fallback_bindings :type: Mapping[str, Any] | None :value: None .. py:attribute:: visual_gameplay_overrides :type: dict[str, Any] .. py:attribute:: visual_debug_overlay_enabled :type: bool :value: True .. py:attribute:: visual_debug_overlay_start_visible :type: bool :value: False .. py:attribute:: visual_debug_overlay_title :type: str :value: 'System Lab' .. py:attribute:: visual_debug_overlay_sections :type: tuple[str, Ellipsis] :value: ('timing', 'render', 'viewport', 'effects', 'stack', 'scene') .. py:attribute:: visual_hot_reload_enabled :type: bool :value: True .. py:attribute:: visual_hot_reload_key :type: str :value: 'F5' .. py:attribute:: visual_hot_reload_poll_seconds :type: float :value: 0.5 .. py:method:: build_system() -> object :abstractmethod: Build the system instance to execute. .. py:method:: build_context() -> object :abstractmethod: Build the context passed into ``system.step(ctx)``. .. py:method:: before_step(*, step_index: int, system: object, ctx: object) -> None Optional hook before each isolated step. .. py:method:: after_step(*, step_index: int, system: object, ctx: object) -> None Optional hook after each isolated step. .. py:method:: summarize(*, system: object, ctx: object, steps: int) -> dict[str, Any] Optional summary data appended to command output. .. py:method:: run_visual() -> int | None Optional interactive runner for visual/system-driven lab cases. Return ``None`` to let the processor fall back to the built-in reusable visual lab runner driven by ``build_visual_spec()``. .. py:method:: build_visual_spec() -> SystemLabVisualSpec | None Build the visual runner specification for this case. The default implementation reuses the context type returned by ``build_context()`` and the visual class attributes declared on the case, which keeps simple experiments down to one file. .. py:method:: build_visual_world(*, viewport: tuple[float, float]) -> object Build the world used by the built-in visual runner. By default this reuses ``build_context().world`` and updates a ``viewport`` attribute if the world defines one. .. py:method:: build_visual_systems() -> tuple[object, Ellipsis] Build the systems installed into the built-in visual runner scene. .. py:method:: build_visual_intent(actions: Any, ctx: Any) -> object | None Optional action-snapshot to intent adapter for the visual runner. .. py:method:: visual_debug_lines(*, world: object) -> list[str] Optional debug overlay lines exposed by the built-in visual runner. .. py:class:: SystemLabRegistry Bases: :py:obj:`mini_arcade.utils.implementation_registry.ImplementationRegistry`\ [\ :py:obj:`BaseSystemLabCase`\ ] Registry of named isolated system cases. .. py:class:: SystemLabVisualSpec Declarative configuration for the built-in visual system lab runner. .. py:attribute:: tick_context_type :type: type[object] .. py:attribute:: title :type: str :value: 'System Lab' .. py:attribute:: scene_id :type: str :value: 'system_lab_visual' .. py:attribute:: fps :type: int :value: 60 .. py:attribute:: virtual_resolution :type: tuple[int, int] :value: (800, 600) .. py:attribute:: window_size :type: tuple[int, int] | None :value: None .. py:attribute:: background_color :type: tuple[int, int, int] :value: (14, 14, 20) .. py:attribute:: backend_provider :type: str :value: 'pygame' .. py:attribute:: controls_scene_key :type: str | None :value: None .. py:attribute:: input_fallback_bindings :type: Mapping[str, Any] | None :value: None .. py:attribute:: intent_factory :type: Callable[[Any, Any], object] | None :value: None .. py:attribute:: gameplay_overrides :type: dict[str, Any] .. py:attribute:: debug_overlay_enabled :type: bool :value: True .. py:attribute:: debug_overlay_start_visible :type: bool :value: False .. py:attribute:: debug_overlay_title :type: str :value: 'System Lab' .. py:attribute:: debug_overlay_sections :type: tuple[str, Ellipsis] :value: ('timing', 'render', 'viewport', 'effects', 'stack', 'scene') .. py:attribute:: hot_reload_enabled :type: bool :value: True .. py:attribute:: hot_reload_key :type: str :value: 'F5' .. py:attribute:: hot_reload_poll_seconds :type: float :value: 0.5