In bluesky, stack-command metadata are represented as a DSL. For example, callsign,alt,[vspd] is equivalent to def selaltcmd(idx: "acid", alt: "alt", vspd: "vspd" = None). Plugins authors wishing to add their own command must learn this DSL and duplicate the type annotations.
The Python signature should become the source of truth for parsing, required/default/nullable/variadic structure, usage text, generated documentation, and external schemas. This can be achieved with Annotated in PEP 593, introspection through get_type_hints(..., include_extras=True), and FastAPI’s use of the Annotated style to generate validation and OpenAPI documentation.
MiniSky should replace opaque string metadata with a small typed descriptor and normalize each callback into one immutable command specification during preparation, something like:
Callsign = Annotated[int, StackArg(parser="callsign", format="callsign")]
Altitude = Annotated[float, StackArg(parser="alt", format="altitude")]
@plugin.command # no more arguments= neeeded!
def altitude(
self,
callsign: Callsign, # here, 'KL204' should be internally transformed into the index
altitude: AltitudeM, # 'FL100' should be internally casted into SI float.
vertical_speed: VerticalSpeedMPerS | None = None,
):
...
Indeed, PR #9 began introducing aliases such as Alt = Annotated[float, "alt"]. We will need to design a small serialisable grammar AST with nodes like sequence, argument, optional, choice, and repeat. This can then be used to drive:
See also: #19 (comment), #19 (comment), #24, #28.
In bluesky, stack-command metadata are represented as a DSL. For example,
callsign,alt,[vspd]is equivalent todef selaltcmd(idx: "acid", alt: "alt", vspd: "vspd" = None). Plugins authors wishing to add their own command must learn this DSL and duplicate the type annotations.The Python signature should become the source of truth for parsing, required/default/nullable/variadic structure, usage text, generated documentation, and external schemas. This can be achieved with
Annotatedin PEP 593, introspection throughget_type_hints(..., include_extras=True), and FastAPI’s use of theAnnotatedstyle to generate validation and OpenAPI documentation.MiniSky should replace opaque string metadata with a small typed descriptor and normalize each callback into one immutable command specification during preparation, something like:
Indeed, PR #9 began introducing aliases such as
Alt = Annotated[float, "alt"]. We will need to design a small serialisable grammar AST with nodes likesequence,argument,optional,choice, andrepeat. This can then be used to drive:HELPcommandGET /commandsendpointSee also: #19 (comment), #19 (comment), #24, #28.