Skip to content

refactor: Combine plans and plan_functions - #1743

Merged
shree-iyengar-dls merged 3 commits into
mainfrom
combing_plans_and_planfunctions
Nov 9, 2026
Merged

shree-iyengar-dls merged 3 commits into
mainfrom
combing_plans_and_planfunctions

Conversation

@shree-iyengar-dls

Copy link
Copy Markdown
Contributor

Fixes #180

Summary of changes:

  • class Plan in blueapi/core/bluesky_types.py is no longer a BlueapiBaseModel but is now a dataclass
  • class Plan contains plan_function which is of the type PlanGenerator
  • class PlanModel remains unchanged
  • the changes above mean we no longer have the duplicated plan_functions dictionary in class BlueskyContext

@codecov

codecov Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.46%. Comparing base (4353ae2) to head (34ce285).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1743   +/-   ##
=======================================
  Coverage   96.46%   96.46%           
=======================================
  Files          49       49           
  Lines        3791     3791           
=======================================
  Hits         3657     3657           
  Misses        134      134           

☔ View full report in Codecov by Harness.
📢 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.

@shree-iyengar-dls shree-iyengar-dls changed the title Combining Plan and Plan functions refactor: Combining Plan and Plan functions Nov 5, 2026
@shree-iyengar-dls
shree-iyengar-dls marked this pull request as ready for review November 5, 2026 17:57
@shree-iyengar-dls
shree-iyengar-dls requested a review from a team as a code owner November 5, 2026 17:57
@tpoliaw tpoliaw changed the title refactor: Combining Plan and Plan functions refactor: Combine plans and plan_functions Nov 9, 2026
@shree-iyengar-dls
shree-iyengar-dls added this pull request to the merge queue Nov 9, 2026
Merged via the queue into main with commit f0c530c Nov 9, 2026
21 of 22 checks passed
@shree-iyengar-dls
shree-iyengar-dls deleted the combing_plans_and_planfunctions branch November 9, 2026 14:00
@tpoliaw tpoliaw linked an issue Nov 9, 2026 that may be closed by this pull request
ZohebShaikh pushed a commit that referenced this pull request Nov 9, 2026
Fixes #180 

Summary of changes:
- `class Plan` in `blueapi/core/bluesky_types.py` is no longer a
`BlueapiBaseModel` but is now a `dataclass`
- `class Plan` contains `plan_function` which is of the type
`PlanGenerator`
- `class PlanModel` remains unchanged
- the changes above mean we no longer have the duplicated
`plan_functions` dictionary in `class BlueskyContext`
ZohebShaikh pushed a commit to ZohebShaikh/blueapi that referenced this pull request Nov 11, 2026
This PR follows DiamondLightSource#1739. Devices in `BlueskyContext` are now wrapped in a
`BlueapiDevice` dataclass. This is similar to DiamondLightSource#1743.

Summary of changes:

- `BlueskyContext.devices` was `dict[str, Device]` where Device
represented bluesky protocols. Now `BlueskyContext.devices` is a
`dict[str, BlueapiDevice]`
- `DeviceModel` and the REST side are unchanged
- `ctx.devices` is a dictionary of `BlueapiDevice` wrappers
- `find_device` will look up the first part of the address (`stage` in
`stage.x`) in `ctx.devices` and returns a `Device`
- `find_component` is no longer a standalone function but has been moved
to `BlueapiDevice`. This functions follows from `find_device`, e.g.
finds the `x` on `stage` to give `stage.x`

---------

Co-authored-by: Peter Holloway <peter.holloway@diamond.ac.uk>
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.

Refactor: Add plan_functions to new PlanModel Combine context.plans and context.plan_functions into a single dictionary

2 participants