opentrons 8.1.0__py2.py3-none-any.whl → 8.2.0__py2.py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (238) hide show
  1. opentrons/cli/analyze.py +71 -7
  2. opentrons/config/__init__.py +9 -0
  3. opentrons/config/advanced_settings.py +22 -0
  4. opentrons/config/defaults_ot3.py +14 -36
  5. opentrons/config/feature_flags.py +4 -0
  6. opentrons/config/types.py +6 -17
  7. opentrons/drivers/absorbance_reader/abstract.py +27 -3
  8. opentrons/drivers/absorbance_reader/async_byonoy.py +208 -154
  9. opentrons/drivers/absorbance_reader/driver.py +24 -15
  10. opentrons/drivers/absorbance_reader/hid_protocol.py +79 -50
  11. opentrons/drivers/absorbance_reader/simulator.py +32 -6
  12. opentrons/drivers/types.py +23 -1
  13. opentrons/execute.py +2 -2
  14. opentrons/hardware_control/api.py +18 -10
  15. opentrons/hardware_control/backends/controller.py +3 -2
  16. opentrons/hardware_control/backends/flex_protocol.py +11 -5
  17. opentrons/hardware_control/backends/ot3controller.py +18 -50
  18. opentrons/hardware_control/backends/ot3simulator.py +7 -6
  19. opentrons/hardware_control/backends/ot3utils.py +1 -0
  20. opentrons/hardware_control/instruments/ot2/pipette_handler.py +22 -82
  21. opentrons/hardware_control/instruments/ot3/pipette_handler.py +10 -2
  22. opentrons/hardware_control/module_control.py +43 -2
  23. opentrons/hardware_control/modules/__init__.py +7 -1
  24. opentrons/hardware_control/modules/absorbance_reader.py +232 -83
  25. opentrons/hardware_control/modules/errors.py +7 -0
  26. opentrons/hardware_control/modules/heater_shaker.py +8 -3
  27. opentrons/hardware_control/modules/magdeck.py +12 -3
  28. opentrons/hardware_control/modules/mod_abc.py +27 -2
  29. opentrons/hardware_control/modules/tempdeck.py +15 -7
  30. opentrons/hardware_control/modules/thermocycler.py +69 -3
  31. opentrons/hardware_control/modules/types.py +11 -5
  32. opentrons/hardware_control/modules/update.py +11 -5
  33. opentrons/hardware_control/modules/utils.py +3 -1
  34. opentrons/hardware_control/ot3_calibration.py +6 -6
  35. opentrons/hardware_control/ot3api.py +131 -94
  36. opentrons/hardware_control/poller.py +15 -11
  37. opentrons/hardware_control/protocols/__init__.py +1 -7
  38. opentrons/hardware_control/protocols/instrument_configurer.py +14 -2
  39. opentrons/hardware_control/protocols/liquid_handler.py +5 -0
  40. opentrons/hardware_control/protocols/position_estimator.py +3 -1
  41. opentrons/hardware_control/types.py +2 -0
  42. opentrons/legacy_commands/helpers.py +8 -2
  43. opentrons/motion_planning/__init__.py +2 -0
  44. opentrons/motion_planning/waypoints.py +32 -0
  45. opentrons/protocol_api/__init__.py +2 -1
  46. opentrons/protocol_api/_liquid.py +87 -1
  47. opentrons/protocol_api/_parameter_context.py +10 -1
  48. opentrons/protocol_api/core/engine/deck_conflict.py +0 -297
  49. opentrons/protocol_api/core/engine/instrument.py +29 -25
  50. opentrons/protocol_api/core/engine/labware.py +20 -4
  51. opentrons/protocol_api/core/engine/module_core.py +166 -17
  52. opentrons/protocol_api/core/engine/pipette_movement_conflict.py +362 -0
  53. opentrons/protocol_api/core/engine/protocol.py +30 -2
  54. opentrons/protocol_api/core/instrument.py +2 -0
  55. opentrons/protocol_api/core/labware.py +4 -0
  56. opentrons/protocol_api/core/legacy/legacy_instrument_core.py +2 -0
  57. opentrons/protocol_api/core/legacy/legacy_labware_core.py +5 -0
  58. opentrons/protocol_api/core/legacy/legacy_protocol_core.py +6 -2
  59. opentrons/protocol_api/core/legacy_simulator/legacy_instrument_core.py +2 -0
  60. opentrons/protocol_api/core/module.py +22 -4
  61. opentrons/protocol_api/core/protocol.py +6 -2
  62. opentrons/protocol_api/instrument_context.py +52 -20
  63. opentrons/protocol_api/labware.py +13 -1
  64. opentrons/protocol_api/module_contexts.py +115 -17
  65. opentrons/protocol_api/protocol_context.py +49 -5
  66. opentrons/protocol_api/validation.py +5 -3
  67. opentrons/protocol_engine/__init__.py +10 -9
  68. opentrons/protocol_engine/actions/__init__.py +3 -0
  69. opentrons/protocol_engine/actions/actions.py +30 -25
  70. opentrons/protocol_engine/actions/get_state_update.py +38 -0
  71. opentrons/protocol_engine/clients/sync_client.py +1 -1
  72. opentrons/protocol_engine/clients/transports.py +1 -1
  73. opentrons/protocol_engine/commands/__init__.py +0 -4
  74. opentrons/protocol_engine/commands/absorbance_reader/__init__.py +41 -11
  75. opentrons/protocol_engine/commands/absorbance_reader/close_lid.py +148 -0
  76. opentrons/protocol_engine/commands/absorbance_reader/initialize.py +65 -9
  77. opentrons/protocol_engine/commands/absorbance_reader/open_lid.py +148 -0
  78. opentrons/protocol_engine/commands/absorbance_reader/read.py +200 -0
  79. opentrons/protocol_engine/commands/aspirate.py +29 -16
  80. opentrons/protocol_engine/commands/aspirate_in_place.py +33 -16
  81. opentrons/protocol_engine/commands/blow_out.py +63 -14
  82. opentrons/protocol_engine/commands/blow_out_in_place.py +55 -13
  83. opentrons/protocol_engine/commands/calibration/calibrate_gripper.py +2 -5
  84. opentrons/protocol_engine/commands/calibration/calibrate_module.py +3 -4
  85. opentrons/protocol_engine/commands/calibration/calibrate_pipette.py +2 -5
  86. opentrons/protocol_engine/commands/calibration/move_to_maintenance_position.py +6 -4
  87. opentrons/protocol_engine/commands/command.py +31 -18
  88. opentrons/protocol_engine/commands/command_unions.py +37 -24
  89. opentrons/protocol_engine/commands/comment.py +5 -3
  90. opentrons/protocol_engine/commands/configure_for_volume.py +11 -14
  91. opentrons/protocol_engine/commands/configure_nozzle_layout.py +9 -15
  92. opentrons/protocol_engine/commands/custom.py +5 -3
  93. opentrons/protocol_engine/commands/dispense.py +42 -20
  94. opentrons/protocol_engine/commands/dispense_in_place.py +32 -14
  95. opentrons/protocol_engine/commands/drop_tip.py +70 -16
  96. opentrons/protocol_engine/commands/drop_tip_in_place.py +59 -13
  97. opentrons/protocol_engine/commands/get_tip_presence.py +5 -3
  98. opentrons/protocol_engine/commands/heater_shaker/close_labware_latch.py +6 -6
  99. opentrons/protocol_engine/commands/heater_shaker/deactivate_heater.py +6 -6
  100. opentrons/protocol_engine/commands/heater_shaker/deactivate_shaker.py +6 -6
  101. opentrons/protocol_engine/commands/heater_shaker/open_labware_latch.py +8 -6
  102. opentrons/protocol_engine/commands/heater_shaker/set_and_wait_for_shake_speed.py +8 -4
  103. opentrons/protocol_engine/commands/heater_shaker/set_target_temperature.py +6 -4
  104. opentrons/protocol_engine/commands/heater_shaker/wait_for_temperature.py +6 -6
  105. opentrons/protocol_engine/commands/home.py +11 -5
  106. opentrons/protocol_engine/commands/liquid_probe.py +146 -88
  107. opentrons/protocol_engine/commands/load_labware.py +28 -5
  108. opentrons/protocol_engine/commands/load_liquid.py +18 -7
  109. opentrons/protocol_engine/commands/load_module.py +4 -6
  110. opentrons/protocol_engine/commands/load_pipette.py +18 -17
  111. opentrons/protocol_engine/commands/magnetic_module/disengage.py +6 -6
  112. opentrons/protocol_engine/commands/magnetic_module/engage.py +6 -4
  113. opentrons/protocol_engine/commands/move_labware.py +155 -23
  114. opentrons/protocol_engine/commands/move_relative.py +15 -3
  115. opentrons/protocol_engine/commands/move_to_addressable_area.py +29 -4
  116. opentrons/protocol_engine/commands/move_to_addressable_area_for_drop_tip.py +13 -4
  117. opentrons/protocol_engine/commands/move_to_coordinates.py +11 -5
  118. opentrons/protocol_engine/commands/move_to_well.py +37 -10
  119. opentrons/protocol_engine/commands/pick_up_tip.py +51 -30
  120. opentrons/protocol_engine/commands/pipetting_common.py +47 -16
  121. opentrons/protocol_engine/commands/prepare_to_aspirate.py +62 -15
  122. opentrons/protocol_engine/commands/reload_labware.py +13 -4
  123. opentrons/protocol_engine/commands/retract_axis.py +6 -3
  124. opentrons/protocol_engine/commands/save_position.py +2 -3
  125. opentrons/protocol_engine/commands/set_rail_lights.py +5 -3
  126. opentrons/protocol_engine/commands/set_status_bar.py +5 -3
  127. opentrons/protocol_engine/commands/temperature_module/deactivate.py +6 -4
  128. opentrons/protocol_engine/commands/temperature_module/set_target_temperature.py +3 -4
  129. opentrons/protocol_engine/commands/temperature_module/wait_for_temperature.py +6 -6
  130. opentrons/protocol_engine/commands/thermocycler/__init__.py +19 -0
  131. opentrons/protocol_engine/commands/thermocycler/close_lid.py +8 -8
  132. opentrons/protocol_engine/commands/thermocycler/deactivate_block.py +6 -4
  133. opentrons/protocol_engine/commands/thermocycler/deactivate_lid.py +6 -4
  134. opentrons/protocol_engine/commands/thermocycler/open_lid.py +8 -4
  135. opentrons/protocol_engine/commands/thermocycler/run_extended_profile.py +165 -0
  136. opentrons/protocol_engine/commands/thermocycler/run_profile.py +6 -6
  137. opentrons/protocol_engine/commands/thermocycler/set_target_block_temperature.py +3 -4
  138. opentrons/protocol_engine/commands/thermocycler/set_target_lid_temperature.py +3 -4
  139. opentrons/protocol_engine/commands/thermocycler/wait_for_block_temperature.py +6 -4
  140. opentrons/protocol_engine/commands/thermocycler/wait_for_lid_temperature.py +6 -4
  141. opentrons/protocol_engine/commands/touch_tip.py +19 -7
  142. opentrons/protocol_engine/commands/unsafe/__init__.py +30 -0
  143. opentrons/protocol_engine/commands/unsafe/unsafe_blow_out_in_place.py +6 -4
  144. opentrons/protocol_engine/commands/unsafe/unsafe_drop_tip_in_place.py +12 -4
  145. opentrons/protocol_engine/commands/unsafe/unsafe_engage_axes.py +5 -3
  146. opentrons/protocol_engine/commands/unsafe/unsafe_place_labware.py +208 -0
  147. opentrons/protocol_engine/commands/unsafe/unsafe_ungrip_labware.py +77 -0
  148. opentrons/protocol_engine/commands/unsafe/update_position_estimators.py +10 -4
  149. opentrons/protocol_engine/commands/verify_tip_presence.py +5 -5
  150. opentrons/protocol_engine/commands/wait_for_duration.py +5 -3
  151. opentrons/protocol_engine/commands/wait_for_resume.py +5 -3
  152. opentrons/protocol_engine/create_protocol_engine.py +60 -10
  153. opentrons/protocol_engine/engine_support.py +2 -1
  154. opentrons/protocol_engine/error_recovery_policy.py +14 -3
  155. opentrons/protocol_engine/errors/__init__.py +20 -0
  156. opentrons/protocol_engine/errors/error_occurrence.py +8 -3
  157. opentrons/protocol_engine/errors/exceptions.py +127 -2
  158. opentrons/protocol_engine/execution/__init__.py +2 -0
  159. opentrons/protocol_engine/execution/command_executor.py +22 -13
  160. opentrons/protocol_engine/execution/create_queue_worker.py +5 -1
  161. opentrons/protocol_engine/execution/door_watcher.py +1 -1
  162. opentrons/protocol_engine/execution/equipment.py +2 -1
  163. opentrons/protocol_engine/execution/error_recovery_hardware_state_synchronizer.py +101 -0
  164. opentrons/protocol_engine/execution/gantry_mover.py +4 -2
  165. opentrons/protocol_engine/execution/hardware_stopper.py +3 -3
  166. opentrons/protocol_engine/execution/heater_shaker_movement_flagger.py +1 -4
  167. opentrons/protocol_engine/execution/labware_movement.py +73 -22
  168. opentrons/protocol_engine/execution/movement.py +17 -7
  169. opentrons/protocol_engine/execution/pipetting.py +7 -4
  170. opentrons/protocol_engine/execution/queue_worker.py +6 -2
  171. opentrons/protocol_engine/execution/run_control.py +1 -1
  172. opentrons/protocol_engine/execution/thermocycler_movement_flagger.py +1 -1
  173. opentrons/protocol_engine/execution/thermocycler_plate_lifter.py +2 -1
  174. opentrons/protocol_engine/execution/tip_handler.py +77 -43
  175. opentrons/protocol_engine/notes/__init__.py +14 -2
  176. opentrons/protocol_engine/notes/notes.py +18 -1
  177. opentrons/protocol_engine/plugins.py +1 -1
  178. opentrons/protocol_engine/protocol_engine.py +47 -31
  179. opentrons/protocol_engine/resources/__init__.py +2 -0
  180. opentrons/protocol_engine/resources/deck_data_provider.py +19 -5
  181. opentrons/protocol_engine/resources/file_provider.py +161 -0
  182. opentrons/protocol_engine/resources/fixture_validation.py +11 -1
  183. opentrons/protocol_engine/resources/labware_validation.py +10 -0
  184. opentrons/protocol_engine/state/__init__.py +0 -70
  185. opentrons/protocol_engine/state/addressable_areas.py +1 -1
  186. opentrons/protocol_engine/state/command_history.py +21 -2
  187. opentrons/protocol_engine/state/commands.py +110 -31
  188. opentrons/protocol_engine/state/files.py +59 -0
  189. opentrons/protocol_engine/state/frustum_helpers.py +440 -0
  190. opentrons/protocol_engine/state/geometry.py +445 -59
  191. opentrons/protocol_engine/state/labware.py +264 -84
  192. opentrons/protocol_engine/state/liquids.py +1 -1
  193. opentrons/protocol_engine/state/module_substates/absorbance_reader_substate.py +21 -3
  194. opentrons/protocol_engine/state/modules.py +145 -90
  195. opentrons/protocol_engine/state/motion.py +33 -14
  196. opentrons/protocol_engine/state/pipettes.py +157 -317
  197. opentrons/protocol_engine/state/state.py +30 -1
  198. opentrons/protocol_engine/state/state_summary.py +3 -0
  199. opentrons/protocol_engine/state/tips.py +69 -114
  200. opentrons/protocol_engine/state/update_types.py +424 -0
  201. opentrons/protocol_engine/state/wells.py +236 -0
  202. opentrons/protocol_engine/types.py +90 -0
  203. opentrons/protocol_reader/file_format_validator.py +83 -15
  204. opentrons/protocol_runner/json_translator.py +21 -5
  205. opentrons/protocol_runner/legacy_command_mapper.py +27 -6
  206. opentrons/protocol_runner/legacy_context_plugin.py +27 -71
  207. opentrons/protocol_runner/protocol_runner.py +6 -3
  208. opentrons/protocol_runner/run_orchestrator.py +41 -6
  209. opentrons/protocols/advanced_control/mix.py +3 -5
  210. opentrons/protocols/advanced_control/transfers.py +125 -56
  211. opentrons/protocols/api_support/constants.py +1 -1
  212. opentrons/protocols/api_support/definitions.py +1 -1
  213. opentrons/protocols/api_support/labware_like.py +4 -4
  214. opentrons/protocols/api_support/tip_tracker.py +2 -2
  215. opentrons/protocols/api_support/types.py +15 -2
  216. opentrons/protocols/api_support/util.py +30 -42
  217. opentrons/protocols/duration/errors.py +1 -1
  218. opentrons/protocols/duration/estimator.py +50 -29
  219. opentrons/protocols/execution/dev_types.py +2 -2
  220. opentrons/protocols/execution/execute_json_v4.py +15 -10
  221. opentrons/protocols/execution/execute_python.py +8 -3
  222. opentrons/protocols/geometry/planning.py +12 -12
  223. opentrons/protocols/labware.py +17 -33
  224. opentrons/protocols/parameters/csv_parameter_interface.py +3 -1
  225. opentrons/simulate.py +3 -3
  226. opentrons/types.py +30 -3
  227. opentrons/util/logging_config.py +34 -0
  228. {opentrons-8.1.0.dist-info → opentrons-8.2.0.dist-info}/METADATA +5 -4
  229. {opentrons-8.1.0.dist-info → opentrons-8.2.0.dist-info}/RECORD +235 -223
  230. opentrons/protocol_engine/commands/absorbance_reader/measure.py +0 -94
  231. opentrons/protocol_engine/commands/configuring_common.py +0 -26
  232. opentrons/protocol_runner/thread_async_queue.py +0 -174
  233. /opentrons/protocol_engine/state/{abstract_store.py → _abstract_store.py} +0 -0
  234. /opentrons/protocol_engine/state/{move_types.py → _move_types.py} +0 -0
  235. {opentrons-8.1.0.dist-info → opentrons-8.2.0.dist-info}/LICENSE +0 -0
  236. {opentrons-8.1.0.dist-info → opentrons-8.2.0.dist-info}/WHEEL +0 -0
  237. {opentrons-8.1.0.dist-info → opentrons-8.2.0.dist-info}/entry_points.txt +0 -0
  238. {opentrons-8.1.0.dist-info → opentrons-8.2.0.dist-info}/top_level.txt +0 -0
@@ -14,10 +14,15 @@ from typing import (
14
14
 
15
15
  from opentrons_shared_data.labware.types import LabwareDefinition
16
16
  from opentrons_shared_data.pipette.types import PipetteNameType
17
+ from opentrons_shared_data.robot.types import RobotTypeEnum
17
18
 
18
19
  from opentrons.types import Mount, Location, DeckLocation, DeckSlotName, StagingSlotName
20
+ from opentrons.config import feature_flags
19
21
  from opentrons.legacy_broker import LegacyBroker
20
- from opentrons.hardware_control.modules.types import MagneticBlockModel
22
+ from opentrons.hardware_control.modules.types import (
23
+ MagneticBlockModel,
24
+ AbsorbanceReaderModel,
25
+ )
21
26
  from opentrons.legacy_commands import protocol_commands as cmds, types as cmd_types
22
27
  from opentrons.legacy_commands.helpers import stringify_labware_movement_command
23
28
  from opentrons.legacy_commands.publisher import (
@@ -39,6 +44,8 @@ from opentrons.protocols.api_support.util import (
39
44
  RobotTypeError,
40
45
  UnsupportedAPIError,
41
46
  )
47
+ from opentrons_shared_data.errors.exceptions import CommandPreconditionViolated
48
+ from opentrons.protocol_engine.errors import LabwareMovementNotAllowedError
42
49
 
43
50
  from ._types import OffDeckType
44
51
  from .core.common import ModuleCore, LabwareCore, ProtocolCore
@@ -57,7 +64,7 @@ from .core.engine import ENGINE_CORE_API_VERSION
57
64
  from .core.legacy.legacy_protocol_core import LegacyProtocolCore
58
65
 
59
66
  from . import validation
60
- from ._liquid import Liquid
67
+ from ._liquid import Liquid, LiquidClass
61
68
  from .disposal_locations import TrashBin, WasteChute
62
69
  from .deck import Deck
63
70
  from .instrument_context import InstrumentContext
@@ -205,8 +212,12 @@ class ProtocolContext(CommandPublisher):
205
212
  return self._api_version
206
213
 
207
214
  @property
208
- @requires_version(2, 20)
215
+ @requires_version(2, 21)
209
216
  def robot(self) -> RobotContext:
217
+ """The :py:class:`.RobotContext` for the protocol.
218
+
219
+ :meta private:
220
+ """
210
221
  return self._robot
211
222
 
212
223
  @property
@@ -653,13 +664,12 @@ class ProtocolContext(CommandPublisher):
653
664
  if slot is not None
654
665
  }
655
666
 
656
- # TODO (spp, 2022-12-14): https://opentrons.atlassian.net/browse/RLAB-237
657
667
  @requires_version(2, 15)
658
668
  def move_labware(
659
669
  self,
660
670
  labware: Labware,
661
671
  new_location: Union[
662
- DeckLocation, Labware, ModuleTypes, OffDeckType, WasteChute
672
+ DeckLocation, Labware, ModuleTypes, OffDeckType, WasteChute, TrashBin
663
673
  ],
664
674
  use_gripper: bool = False,
665
675
  pick_up_offset: Optional[Mapping[str, float]] = None,
@@ -704,6 +714,14 @@ class ProtocolContext(CommandPublisher):
704
714
  f"Expected labware of type 'Labware' but got {type(labware)}."
705
715
  )
706
716
 
717
+ # Ensure that when moving to an absorbance reader that the lid is open
718
+ # todo(mm, 2024-11-08): Unify this with opentrons.protocol_api.core.engine.deck_conflict.
719
+ if isinstance(new_location, AbsorbanceReaderContext):
720
+ if new_location.is_lid_on():
721
+ raise CommandPreconditionViolated(
722
+ f"Cannot move {labware.name} onto the Absorbance Reader Module when its lid is closed."
723
+ )
724
+
707
725
  location: Union[
708
726
  ModuleCore,
709
727
  LabwareCore,
@@ -711,11 +729,19 @@ class ProtocolContext(CommandPublisher):
711
729
  OffDeckType,
712
730
  DeckSlotName,
713
731
  StagingSlotName,
732
+ TrashBin,
714
733
  ]
715
734
  if isinstance(new_location, (Labware, ModuleContext)):
716
735
  location = new_location._core
717
736
  elif isinstance(new_location, (OffDeckType, WasteChute)):
718
737
  location = new_location
738
+ elif isinstance(new_location, TrashBin):
739
+ if labware._core.is_lid():
740
+ location = new_location
741
+ else:
742
+ raise LabwareMovementNotAllowedError(
743
+ "Can only dispose of tips and Lid-type labware in a Trash Bin. Did you mean to use a Waste Chute?"
744
+ )
719
745
  else:
720
746
  location = validation.ensure_and_convert_deck_slot(
721
747
  new_location, self._api_version, self._core.robot_type
@@ -827,6 +853,12 @@ class ProtocolContext(CommandPublisher):
827
853
  until_version="2.15",
828
854
  current_version=f"{self._api_version}",
829
855
  )
856
+ if isinstance(
857
+ requested_model, AbsorbanceReaderModel
858
+ ) and self._api_version < APIVersion(2, 21):
859
+ raise APIVersionError(
860
+ f"Module of type {module_name} is only available in versions 2.21 and above."
861
+ )
830
862
 
831
863
  deck_slot = (
832
864
  None
@@ -1264,6 +1296,18 @@ class ProtocolContext(CommandPublisher):
1264
1296
  display_color=display_color,
1265
1297
  )
1266
1298
 
1299
+ def define_liquid_class(
1300
+ self,
1301
+ name: str,
1302
+ ) -> LiquidClass:
1303
+ """Define a liquid class for use in the protocol."""
1304
+ if feature_flags.allow_liquid_classes(
1305
+ robot_type=RobotTypeEnum.robot_literal_to_enum(self._core.robot_type)
1306
+ ):
1307
+ return self._core.define_liquid_class(name=name)
1308
+ else:
1309
+ raise NotImplementedError("This method is not implemented.")
1310
+
1267
1311
  @property
1268
1312
  @requires_version(2, 5)
1269
1313
  def rail_lights_on(self) -> bool:
@@ -18,7 +18,7 @@ from opentrons_shared_data.labware.labware_definition import LabwareRole
18
18
  from opentrons_shared_data.pipette.types import PipetteNameType
19
19
  from opentrons_shared_data.robot.types import RobotType
20
20
 
21
- from opentrons.protocols.api_support.types import APIVersion
21
+ from opentrons.protocols.api_support.types import APIVersion, ThermocyclerStep
22
22
  from opentrons.protocols.api_support.util import APIVersionError
23
23
  from opentrons.protocols.models import LabwareDefinition
24
24
  from opentrons.types import Mount, DeckSlotName, StagingSlotName, Location
@@ -30,7 +30,6 @@ from opentrons.hardware_control.modules.types import (
30
30
  HeaterShakerModuleModel,
31
31
  MagneticBlockModel,
32
32
  AbsorbanceReaderModel,
33
- ThermocyclerStep,
34
33
  )
35
34
 
36
35
  from .disposal_locations import TrashBin, WasteChute
@@ -436,10 +435,13 @@ class LocationTypeError(TypeError):
436
435
  """Error representing that the location supplied is of different expected type."""
437
436
 
438
437
 
438
+ ValidTarget = Union[WellTarget, PointTarget, TrashBin, WasteChute]
439
+
440
+
439
441
  def validate_location(
440
442
  location: Union[Location, Well, TrashBin, WasteChute, None],
441
443
  last_location: Optional[Location],
442
- ) -> Union[WellTarget, PointTarget, TrashBin, WasteChute]:
444
+ ) -> ValidTarget:
443
445
  """Validate a given location for a liquid handling command.
444
446
 
445
447
  Args:
@@ -18,15 +18,10 @@ from .commands import (
18
18
  CommandType,
19
19
  CommandIntent,
20
20
  )
21
- from .state import (
22
- State,
23
- StateView,
24
- StateSummary,
25
- CommandSlice,
26
- CommandPointer,
27
- Config,
28
- CommandErrorSlice,
29
- )
21
+ from .state.state import State, StateView
22
+ from .state.state_summary import StateSummary
23
+ from .state.commands import CommandSlice, CommandErrorSlice, CommandPointer
24
+ from .state.config import Config
30
25
  from .plugins import AbstractPlugin
31
26
 
32
27
  from .types import (
@@ -52,9 +47,12 @@ from .types import (
52
47
  LoadedPipette,
53
48
  MotorAxis,
54
49
  WellLocation,
50
+ LiquidHandlingWellLocation,
51
+ PickUpTipWellLocation,
55
52
  DropTipWellLocation,
56
53
  WellOrigin,
57
54
  DropTipWellOrigin,
55
+ PickUpTipWellOrigin,
58
56
  WellOffset,
59
57
  ModuleModel,
60
58
  ModuleDefinition,
@@ -114,9 +112,12 @@ __all__ = [
114
112
  "LoadedPipette",
115
113
  "MotorAxis",
116
114
  "WellLocation",
115
+ "LiquidHandlingWellLocation",
116
+ "PickUpTipWellLocation",
117
117
  "DropTipWellLocation",
118
118
  "WellOrigin",
119
119
  "DropTipWellOrigin",
120
+ "PickUpTipWellOrigin",
120
121
  "WellOffset",
121
122
  "ModuleModel",
122
123
  "ModuleDefinition",
@@ -29,6 +29,7 @@ from .actions import (
29
29
  ResetTipsAction,
30
30
  SetPipetteMovementSpeedAction,
31
31
  )
32
+ from .get_state_update import get_state_updates
32
33
 
33
34
  __all__ = [
34
35
  # action pipeline interface
@@ -59,4 +60,6 @@ __all__ = [
59
60
  # action payload values
60
61
  "PauseSource",
61
62
  "FinishErrorDetails",
63
+ # helper functions
64
+ "get_state_updates",
62
65
  ]
@@ -3,7 +3,7 @@
3
3
  Actions can be passed to the ActionDispatcher, where they will trigger
4
4
  reactions in objects that subscribe to the pipeline, like the StateStore.
5
5
  """
6
- from dataclasses import dataclass
6
+ import dataclasses
7
7
  from datetime import datetime
8
8
  from enum import Enum
9
9
  from typing import List, Optional, Union
@@ -18,10 +18,10 @@ from ..commands import (
18
18
  Command,
19
19
  CommandCreate,
20
20
  CommandDefinedErrorData,
21
- CommandPrivateResult,
22
21
  )
23
22
  from ..error_recovery_policy import ErrorRecoveryPolicy, ErrorRecoveryType
24
23
  from ..notes.notes import CommandNote
24
+ from ..state.update_types import StateUpdate
25
25
  from ..types import (
26
26
  LabwareOffsetCreate,
27
27
  ModuleDefinition,
@@ -31,7 +31,7 @@ from ..types import (
31
31
  )
32
32
 
33
33
 
34
- @dataclass(frozen=True)
34
+ @dataclasses.dataclass(frozen=True)
35
35
  class PlayAction:
36
36
  """Start or resume processing commands in the engine."""
37
37
 
@@ -50,28 +50,28 @@ class PauseSource(str, Enum):
50
50
  PROTOCOL = "protocol"
51
51
 
52
52
 
53
- @dataclass(frozen=True)
53
+ @dataclasses.dataclass(frozen=True)
54
54
  class PauseAction:
55
55
  """Pause processing commands in the engine."""
56
56
 
57
57
  source: PauseSource
58
58
 
59
59
 
60
- @dataclass(frozen=True)
60
+ @dataclasses.dataclass(frozen=True)
61
61
  class StopAction:
62
62
  """Request engine execution to stop soon."""
63
63
 
64
64
  from_estop: bool = False
65
65
 
66
66
 
67
- @dataclass(frozen=True)
67
+ @dataclasses.dataclass(frozen=True)
68
68
  class ResumeFromRecoveryAction:
69
69
  """See `ProtocolEngine.resume_from_recovery()`."""
70
70
 
71
- pass
71
+ state_update: StateUpdate
72
72
 
73
73
 
74
- @dataclass(frozen=True)
74
+ @dataclasses.dataclass(frozen=True)
75
75
  class FinishErrorDetails:
76
76
  """Error details for the payload of a FinishAction or HardwareStoppedAction."""
77
77
 
@@ -80,7 +80,7 @@ class FinishErrorDetails:
80
80
  created_at: datetime
81
81
 
82
82
 
83
- @dataclass(frozen=True)
83
+ @dataclasses.dataclass(frozen=True)
84
84
  class FinishAction:
85
85
  """Gracefully stop processing commands in the engine."""
86
86
 
@@ -95,7 +95,7 @@ class FinishAction:
95
95
  """The fatal error that caused the run to fail."""
96
96
 
97
97
 
98
- @dataclass(frozen=True)
98
+ @dataclasses.dataclass(frozen=True)
99
99
  class HardwareStoppedAction:
100
100
  """An action dispatched after hardware has been stopped for good, for this engine instance."""
101
101
 
@@ -105,14 +105,14 @@ class HardwareStoppedAction:
105
105
  """The error that happened while doing post-run finish steps (homing and dropping tips)."""
106
106
 
107
107
 
108
- @dataclass(frozen=True)
108
+ @dataclasses.dataclass(frozen=True)
109
109
  class DoorChangeAction:
110
110
  """Handle events coming in from hardware control."""
111
111
 
112
112
  door_state: DoorState
113
113
 
114
114
 
115
- @dataclass(frozen=True)
115
+ @dataclasses.dataclass(frozen=True)
116
116
  class QueueCommandAction:
117
117
  """Add a command request to the queue."""
118
118
 
@@ -123,7 +123,7 @@ class QueueCommandAction:
123
123
  failed_command_id: Optional[str] = None
124
124
 
125
125
 
126
- @dataclass(frozen=True)
126
+ @dataclasses.dataclass(frozen=True)
127
127
  class RunCommandAction:
128
128
  """Mark a given command as running.
129
129
 
@@ -135,7 +135,7 @@ class RunCommandAction:
135
135
  started_at: datetime
136
136
 
137
137
 
138
- @dataclass(frozen=True)
138
+ @dataclasses.dataclass(frozen=True)
139
139
  class SucceedCommandAction:
140
140
  """Mark a given command as succeeded.
141
141
 
@@ -145,10 +145,15 @@ class SucceedCommandAction:
145
145
  command: Command
146
146
  """The command in its new succeeded state."""
147
147
 
148
- private_result: CommandPrivateResult
148
+ state_update: StateUpdate = dataclasses.field(
149
+ # todo(mm, 2024-08-26): This has a default only to make it easier to transition
150
+ # old tests while https://opentrons.atlassian.net/browse/EXEC-639 is in
151
+ # progress. Make this mandatory when that's completed.
152
+ default_factory=StateUpdate
153
+ )
149
154
 
150
155
 
151
- @dataclass(frozen=True)
156
+ @dataclasses.dataclass(frozen=True)
152
157
  class FailCommandAction:
153
158
  """Mark a given command as failed.
154
159
 
@@ -196,7 +201,7 @@ class FailCommandAction:
196
201
  """The command to fail, in its prior `running` state."""
197
202
 
198
203
 
199
- @dataclass(frozen=True)
204
+ @dataclasses.dataclass(frozen=True)
200
205
  class AddLabwareOffsetAction:
201
206
  """Add a labware offset, to apply to subsequent `LoadLabwareCommand`s."""
202
207
 
@@ -205,28 +210,28 @@ class AddLabwareOffsetAction:
205
210
  request: LabwareOffsetCreate
206
211
 
207
212
 
208
- @dataclass(frozen=True)
213
+ @dataclasses.dataclass(frozen=True)
209
214
  class AddLabwareDefinitionAction:
210
215
  """Add a labware definition, to apply to subsequent `LoadLabwareCommand`s."""
211
216
 
212
217
  definition: LabwareDefinition
213
218
 
214
219
 
215
- @dataclass(frozen=True)
220
+ @dataclasses.dataclass(frozen=True)
216
221
  class AddLiquidAction:
217
222
  """Add a liquid, to apply to subsequent `LoadLiquid`s."""
218
223
 
219
224
  liquid: Liquid
220
225
 
221
226
 
222
- @dataclass(frozen=True)
227
+ @dataclasses.dataclass(frozen=True)
223
228
  class SetDeckConfigurationAction:
224
229
  """See `ProtocolEngine.set_deck_configuration()`."""
225
230
 
226
231
  deck_configuration: Optional[DeckConfigurationType]
227
232
 
228
233
 
229
- @dataclass(frozen=True)
234
+ @dataclasses.dataclass(frozen=True)
230
235
  class AddAddressableAreaAction:
231
236
  """Add a single addressable area to state.
232
237
 
@@ -238,7 +243,7 @@ class AddAddressableAreaAction:
238
243
  addressable_area: AddressableAreaLocation
239
244
 
240
245
 
241
- @dataclass(frozen=True)
246
+ @dataclasses.dataclass(frozen=True)
242
247
  class AddModuleAction:
243
248
  """Add an attached module directly to state without a location."""
244
249
 
@@ -248,14 +253,14 @@ class AddModuleAction:
248
253
  module_live_data: LiveData
249
254
 
250
255
 
251
- @dataclass(frozen=True)
256
+ @dataclasses.dataclass(frozen=True)
252
257
  class ResetTipsAction:
253
258
  """Reset the tip tracking state of a given tip rack."""
254
259
 
255
260
  labware_id: str
256
261
 
257
262
 
258
- @dataclass(frozen=True)
263
+ @dataclasses.dataclass(frozen=True)
259
264
  class SetPipetteMovementSpeedAction:
260
265
  """Set the speed of a pipette's X/Y/Z movements. Does not affect plunger speed.
261
266
 
@@ -266,7 +271,7 @@ class SetPipetteMovementSpeedAction:
266
271
  speed: Optional[float]
267
272
 
268
273
 
269
- @dataclass(frozen=True)
274
+ @dataclasses.dataclass(frozen=True)
270
275
  class SetErrorRecoveryPolicyAction:
271
276
  """See `ProtocolEngine.set_error_recovery_policy()`."""
272
277
 
@@ -0,0 +1,38 @@
1
+ # noqa: D100
2
+ from __future__ import annotations
3
+ from typing import TYPE_CHECKING
4
+
5
+ from .actions import (
6
+ Action,
7
+ ResumeFromRecoveryAction,
8
+ SucceedCommandAction,
9
+ FailCommandAction,
10
+ )
11
+ from ..commands.command import DefinedErrorData
12
+ from ..error_recovery_policy import ErrorRecoveryType
13
+
14
+ if TYPE_CHECKING:
15
+ from ..state.update_types import StateUpdate
16
+
17
+
18
+ def get_state_updates(action: Action) -> list[StateUpdate]:
19
+ """Extract all the StateUpdates that the StateStores should apply when they apply an action."""
20
+ if isinstance(action, SucceedCommandAction):
21
+ return [action.state_update]
22
+
23
+ elif isinstance(action, FailCommandAction) and isinstance(
24
+ action.error, DefinedErrorData
25
+ ):
26
+ if action.type == ErrorRecoveryType.ASSUME_FALSE_POSITIVE_AND_CONTINUE:
27
+ return [
28
+ action.error.state_update,
29
+ action.error.state_update_if_false_positive,
30
+ ]
31
+ else:
32
+ return [action.error.state_update]
33
+
34
+ elif isinstance(action, ResumeFromRecoveryAction):
35
+ return [action.state_update]
36
+
37
+ else:
38
+ return []
@@ -7,7 +7,7 @@ from opentrons_shared_data.labware.labware_definition import LabwareDefinition
7
7
 
8
8
  from .. import commands
9
9
  from ..commands.command_unions import CREATE_TYPES_BY_PARAMS_TYPE
10
- from ..state import StateView
10
+ from ..state.state import StateView
11
11
  from ..types import (
12
12
  Liquid,
13
13
  LabwareOffsetCreate,
@@ -10,7 +10,7 @@ from opentrons_shared_data.labware.labware_definition import LabwareDefinition
10
10
  from ..protocol_engine import ProtocolEngine
11
11
  from ..errors import ProtocolCommandFailedError
12
12
  from ..error_recovery_policy import ErrorRecoveryType
13
- from ..state import StateView
13
+ from ..state.state import StateView
14
14
  from ..commands import Command, CommandCreate, CommandResult, CommandStatus
15
15
 
16
16
 
@@ -38,7 +38,6 @@ from .command_unions import (
38
38
  CommandCreate,
39
39
  CommandResult,
40
40
  CommandType,
41
- CommandPrivateResult,
42
41
  CommandDefinedErrorData,
43
42
  )
44
43
 
@@ -153,7 +152,6 @@ from .load_pipette import (
153
152
  LoadPipetteCreate,
154
153
  LoadPipetteResult,
155
154
  LoadPipetteCommandType,
156
- LoadPipettePrivateResult,
157
155
  )
158
156
 
159
157
  from .move_labware import (
@@ -306,7 +304,6 @@ from .configure_nozzle_layout import (
306
304
  ConfigureNozzleLayoutCreate,
307
305
  ConfigureNozzleLayoutParams,
308
306
  ConfigureNozzleLayoutResult,
309
- ConfigureNozzleLayoutPrivateResult,
310
307
  ConfigureNozzleLayoutCommandType,
311
308
  )
312
309
 
@@ -569,7 +566,6 @@ __all__ = [
569
566
  "ConfigureNozzleLayoutParams",
570
567
  "ConfigureNozzleLayoutResult",
571
568
  "ConfigureNozzleLayoutCommandType",
572
- "ConfigureNozzleLayoutPrivateResult",
573
569
  # get pipette tip presence bundle
574
570
  "GetTipPresence",
575
571
  "GetTipPresenceCreate",
@@ -1,4 +1,19 @@
1
1
  """Command models for Absorbance Reader commands."""
2
+ from .close_lid import (
3
+ CloseLidCommandType,
4
+ CloseLidParams,
5
+ CloseLidResult,
6
+ CloseLid,
7
+ CloseLidCreate,
8
+ )
9
+
10
+ from .open_lid import (
11
+ OpenLidCommandType,
12
+ OpenLidParams,
13
+ OpenLidResult,
14
+ OpenLid,
15
+ OpenLidCreate,
16
+ )
2
17
 
3
18
  from .initialize import (
4
19
  InitializeCommandType,
@@ -8,15 +23,29 @@ from .initialize import (
8
23
  InitializeCreate,
9
24
  )
10
25
 
11
- from .measure import (
12
- MeasureAbsorbanceCommandType,
13
- MeasureAbsorbanceParams,
14
- MeasureAbsorbanceResult,
15
- MeasureAbsorbance,
16
- MeasureAbsorbanceCreate,
26
+ from .read import (
27
+ ReadAbsorbanceCommandType,
28
+ ReadAbsorbanceParams,
29
+ ReadAbsorbanceResult,
30
+ ReadAbsorbance,
31
+ ReadAbsorbanceCreate,
17
32
  )
18
33
 
34
+
19
35
  __all__ = [
36
+ "MoveLidResult",
37
+ # absorbanace_reader/closeLid
38
+ "CloseLidCommandType",
39
+ "CloseLidParams",
40
+ "CloseLidResult",
41
+ "CloseLid",
42
+ "CloseLidCreate",
43
+ # absorbanace_reader/openLid
44
+ "OpenLidCommandType",
45
+ "OpenLidParams",
46
+ "OpenLidResult",
47
+ "OpenLid",
48
+ "OpenLidCreate",
20
49
  # absorbanace_reader/initialize
21
50
  "InitializeCommandType",
22
51
  "InitializeParams",
@@ -24,9 +53,10 @@ __all__ = [
24
53
  "Initialize",
25
54
  "InitializeCreate",
26
55
  # absorbanace_reader/measure
27
- "MeasureAbsorbanceCommandType",
28
- "MeasureAbsorbanceParams",
29
- "MeasureAbsorbanceResult",
30
- "MeasureAbsorbance",
31
- "MeasureAbsorbanceCreate",
56
+ "ReadAbsorbanceCommandType",
57
+ "ReadAbsorbanceParams",
58
+ "ReadAbsorbanceResult",
59
+ "ReadAbsorbance",
60
+ "ReadAbsorbanceCreate",
61
+ # union type
32
62
  ]