step.annotation¶
Attributes¶
Classes¶
Discovery metadata attached by |
Functions¶
|
Mark a Step class for builder + DSL function generation. |
|
Mark a class or function as part of the DSL. |
Module Contents¶
- class step.annotation.DslMeta¶
Discovery metadata attached by
@dslto steps and factories.
- step.annotation.T¶
- step.annotation.F¶
- step.annotation.dsl_step(cls: T) T¶
- step.annotation.dsl_step(cls: None = None, *, tags: list[str] | tuple[str, Ellipsis] | None = None) Callable[[T], T]
Mark a Step class for builder + DSL function generation.
Codegen scans for classes decorated with
@dsl_step, introspects their__init__parameters, and generates:A
<ClassName>Builder(StepBuilder)with fluent setter methodsA
snake_case()factory function decorated with@dsl(tags=...)
The marker also applies
@dsl(hidden=True)so the raw class is hidden from the UI (users interact via the generated DSL function).Usage:
@dsl_step(tags=["motion", "drive"]) class DriveForward(MotionStep): def __init__(self, cm: float = None, speed: float = 1.0, until: StopCondition = None): ...
Codegen produces
DriveForwardBuilderanddrive_forward(). Tags are propagated to the generated@dsl(tags=...)factory.
- step.annotation.dsl(_target: T) T¶
- step.annotation.dsl(_target: F) F
- step.annotation.dsl(_target: None = None, *, hidden: bool = False, name: str | None = None, tags: list[str] | tuple[str, Ellipsis] | None = None) Callable[[T | F], T | F]
Mark a class or function as part of the DSL.
- Usage:
@dsl class X(Step): …
@dsl(hidden=True, name=”TurnLeft”, tags=[“movement”, “rotation”]) class Y(Step): …
@dsl(name=”Wait”, tags=[“timing”]) def wait_seconds(seconds: float) -> WaitStep:
return WaitStep(seconds)
- Parameters:
hidden – If True, hide from auto-discovery/UI.
name – Custom display name (defaults to class/function name).
tags – List of tags for grouping in web UI.