-
Notifications
You must be signed in to change notification settings - Fork 8
feat!: Redesign BlueapiClient for use in scripts #1323
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: find-device
Are you sure you want to change the base?
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## find-device #1323 +/- ##
===============================================
+ Coverage 95.00% 95.34% +0.34%
===============================================
Files 42 42
Lines 2761 2900 +139
===============================================
+ Hits 2623 2765 +142
+ Misses 138 135 -3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Some initial thoughts without having looked into it too much:
|
|
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.
The The
Not a bad idea but all the |
|
This requires #1315 |
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
Where previously the BlueapiClient was mostly a thin wrapper around the
BlueapiRestClient, it is now a more standalone class intended to be
usable from other scripts/applications as well as interactive sessions.
The client can now be created from just the path to a config file
without the user having to handle parsing.
Plans can now be run with less boilerplate with a more method-like
interface. Available devices can be queried and then used as if they
were local objects when running plans.
Using the new client
This client can then be reused to run plans or query devices.
Sub-devices can also be accessed, while checking that the sub-device
exists on the server:
Available plans can be accessed from the server and treated
(approximately) like local methods. Calling a plan as a method blocks
while the plan is running
Other client methods have been replaced by (cached) properties:
While running in an interactive session, plans and devices are
auto-completable if the REPL supports it.