Skip to content

Python client plan __repr__ doesn't take into account *args **kwargs #1718

Open

Description

@oliwenmandiamond

When using the python client, is it extremely useful for a user to understand what parameters a plan takes. They can remind them selves by simply typing the plan name and the __repr__ will display a string representation of the plan parameters.

The current schema doesn't have enough information for the client to correctly rebuild the required plan arguments to inform a user what a plan parameters expect to take. Currently blueapi would provide the user the below:

>>> bc.plans.step_grid_scan
step_grid_scan(
    detectors: list[Readable | AsyncReadable],
    trajectory: list[Any],
    extra_trajectories: list[list[Any]] | None = None,
    snake_axes: bool = True,
    metadata: dict | None = None
) 

However, this should look like this instead:

>>> pl.step_grid_scan
step_grid_scan(
    detectors: Sequence[Readable | AsyncReadable],
    trajectory: tuple[Movable[float], float, float, float],
    *extra_trajectories: tuple[Movable[float], float, float, float],
    snake_axes: bool = True,
    metadata: dict[str, Any] | None = None
)

As you can see, the current implementation doesn't show the user what parameters are * and **. It also doesn't handle tuples or able to resolve the required types inside the tuple.

I got this working with a proof of concept here #1663 but is too stale and too hard to rebase as it was based on original *args **kwargs implementation with V1 and V2 task and parameters. It adds additional information to assist the schema, though it should probably enhance the schema.

Acceptance Criteria

  • Client plan cache __repr__ displays to a user the correct parameters a plan should take
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions