Skip to content

BlueapiClient doesn't report the correct default values or display types for plans #1505

@oliwenmandiamond

Description

@oliwenmandiamond

When using BlueapiClient, it doesn't report the correct default values back to the user for a plan, it seems to always report None.

An example is show below:

>>> plans.count
count(detectors, num=None, delay=None, metadata=None)

It is showing that num default is None and delay is None when in fact this is actually 1 and zero as shown below.

@attach_data_session_metadata_decorator()
@validate_call(config={"arbitrary_types_allowed": True})
def count(
    detectors: Annotated[
        set[Readable],
        Field(
            description="Set of readable devices, will take a reading at each point",
            min_length=1,
        ),
    ],
    num: Annotated[int, Field(description="Number of frames to collect", ge=1)] = 1,
    delay: Annotated[
        NonNegativeFloat | Sequence[NonNegativeFloat],
        Field(
            description="Delay between readings: if tuple, len(delay) == num - 1 and \
            the delays are between each point, if value or None is the delay for every \
            gap",
            json_schema_extra={"units": "s"},
        ),
    ] = 0.0,
    metadata: dict[str, Any] | None = None,
) -> MsgGenerator: 

It also doesn't display any type checking of what the plan argument types are meant to be to the user. I've created a fix for this https://github.com/DiamondLightSource/blueapi/

Acceptance Criteria

  • The plan schema shows the correct default values for arguments.
  • The plan scema shows the correct types it expects.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions