You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: Support for dataclasses as composite types (#1242)
This modifies the previous PR #1231 and adds the following:
* Simplifies the creation of composites, the composite no longer needs
to be an instance of `BaseModel` and instead can be a dataclass
* The composite does not need to specify a default and instead
determines the device to inject from the attribute name
Copy file name to clipboardExpand all lines: docs/how-to/write-plans.md
+18-1Lines changed: 18 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -24,7 +24,24 @@ The type annotations in the example above (e.g. `: str`, `: int`, `-> MsgGenerat
24
24
25
25
## Injecting Devices
26
26
27
-
Some plans are created for specific sets of devices, or will almost always be used with the same devices, it is useful to be able to specify defaults. [Dodal makes this easy with its factory functions](https://diamondlightsource.github.io/dodal/main/how-to/include-devices-in-plans.html).
27
+
Some plans are created for specific sets of devices, or will almost always be used with the same devices, it is useful to be able to specify defaults. [Dodal makes this easy with its inject function](https://diamondlightsource.github.io/dodal/main/reference/generated/dodal.common.html#dodal.common.inject).
28
+
29
+
## Injecting multiple devices
30
+
31
+
If a plan requires multiple devices to be injected at once, rather than have a plan with several device parameters each of them with their own injection default, it is possible to define a device composite which can be accepted as a parameter.
32
+
33
+
For example you could define a composite as below:
0 commit comments