Skip to content

Conversation

@tpoliaw
Copy link
Contributor

@tpoliaw tpoliaw commented Jan 6, 2026

Implementation of a simple user client following discussion in #1284

@codecov
Copy link

codecov bot commented Jan 6, 2026

Codecov Report

❌ Patch coverage is 98.36957% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 94.90%. Comparing base (038fe03) to head (3ad951e).

Files with missing lines Patch % Lines
src/blueapi/cli/format.py 94.59% 2 Missing ⚠️
src/blueapi/cli/cli.py 85.71% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1323      +/-   ##
==========================================
+ Coverage   94.76%   94.90%   +0.13%     
==========================================
  Files          42       42              
  Lines        2752     2866     +114     
==========================================
+ Hits         2608     2720     +112     
- Misses        144      146       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@DominicOram
Copy link
Contributor

Some initial thoughts without having looked into it too much:

  • Without docs/more usage tests it's not obvious to me what the interface is supposed to look like. It looks like I can run my plan by either doing client.plans.my_plan(args) or something like client.run_task(TaskRequest(name="my_plan"...). We should only allow one and make the other private. client.plans.my_plan(args) feels quite magic to me but I do quite like it as an interface as it reads really nicely for the end scripts
  • Should: What is the difference between run_task and create_and_start_task seems to me we only need one?
  • Could: I think that for a user a task and a plan are pretty synonymous so I would change the wording so that the client just talks about plans, not tasks

@tpoliaw
Copy link
Contributor Author

tpoliaw commented Jan 8, 2026

Thanks for looking at it. You're right, it needs a lot more docs but I wanted to wait to check the interface was vaguely right before writing it up. I'll add something to the PR for now.

  • It looks like I can run my plan by either doing client.plans.my_plan(args) or something like client.run_task(TaskRequest(name="my_plan"...). We should only allow one and make the other private.

The client.plans.my_plan(client.devices.stage.x, optional=other) interface is the one added here and is the one intended for use in scripts.

The run_task/create_and_start_task methods were there before and I didn't want to break backwards compatibility too much. Maybe if we're changing it anyway, breaking everything at once isn't the end of the world.

  • Should: What is the difference between run_task and create_and_start_task seems to me we only need one?

run_task blocks, create_and_start doesn't

  • Could: I think that for a user a task and a plan are pretty synonymous so I would change the wording so that the client just talks about plans, not tasks

Not a bad idea but all the task related things were here before this PR so should be a separate change. Could be rolled into #1080 as that already removes the TaskRequest parameters

tpoliaw added 17 commits January 8, 2026 17:04
Using the find_device method instead of looking devices up in the map of
devices directly means child devices can be found, eg 'stage.x' could be
a valid device but isn't in the devices map in its own right.
Allows autocomplete to work when working in a REPL
* Support args as well as kwargs when running plans
* Get child devices via attributes on parent devices
* Make more methods into properties
For some reason pyright can't figure out what the return type is
otherwise and you don't get completion.
It broke type checking
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants