opentrons 8.6.0a11__py3-none-any.whl → 8.7.0__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 (40) hide show
  1. opentrons/_version.py +2 -2
  2. opentrons/cli/analyze.py +58 -2
  3. opentrons/drivers/asyncio/communication/serial_connection.py +8 -5
  4. opentrons/drivers/flex_stacker/driver.py +6 -1
  5. opentrons/hardware_control/backends/flex_protocol.py +1 -0
  6. opentrons/hardware_control/backends/ot3controller.py +25 -13
  7. opentrons/hardware_control/backends/ot3simulator.py +2 -1
  8. opentrons/hardware_control/dev_types.py +3 -1
  9. opentrons/hardware_control/instruments/ot2/pipette_handler.py +1 -0
  10. opentrons/hardware_control/instruments/ot3/pipette_handler.py +1 -0
  11. opentrons/hardware_control/ot3api.py +3 -1
  12. opentrons/hardware_control/protocols/gripper_controller.py +1 -0
  13. opentrons/protocol_api/core/engine/_default_liquid_class_versions.py +56 -0
  14. opentrons/protocol_api/core/engine/instrument.py +143 -18
  15. opentrons/protocol_api/core/engine/pipette_movement_conflict.py +77 -17
  16. opentrons/protocol_api/core/engine/protocol.py +53 -7
  17. opentrons/protocol_api/core/engine/transfer_components_executor.py +36 -20
  18. opentrons/protocol_api/core/legacy/legacy_protocol_core.py +1 -1
  19. opentrons/protocol_api/core/protocol.py +1 -1
  20. opentrons/protocol_api/labware.py +36 -2
  21. opentrons/protocol_api/module_contexts.py +146 -14
  22. opentrons/protocol_api/protocol_context.py +162 -12
  23. opentrons/protocol_api/validation.py +4 -0
  24. opentrons/protocol_engine/commands/command_unions.py +2 -0
  25. opentrons/protocol_engine/commands/flex_stacker/common.py +13 -0
  26. opentrons/protocol_engine/commands/flex_stacker/store.py +20 -2
  27. opentrons/protocol_engine/execution/labware_movement.py +14 -12
  28. opentrons/protocol_engine/resources/pipette_data_provider.py +3 -0
  29. opentrons/protocol_engine/state/geometry.py +33 -5
  30. opentrons/protocol_engine/state/labware.py +66 -0
  31. opentrons/protocol_engine/state/modules.py +6 -0
  32. opentrons/protocol_engine/state/pipettes.py +12 -3
  33. opentrons/protocol_engine/types/__init__.py +2 -0
  34. opentrons/protocol_engine/types/labware.py +9 -0
  35. opentrons/protocols/api_support/definitions.py +1 -1
  36. {opentrons-8.6.0a11.dist-info → opentrons-8.7.0.dist-info}/METADATA +4 -4
  37. {opentrons-8.6.0a11.dist-info → opentrons-8.7.0.dist-info}/RECORD +40 -39
  38. {opentrons-8.6.0a11.dist-info → opentrons-8.7.0.dist-info}/WHEEL +0 -0
  39. {opentrons-8.6.0a11.dist-info → opentrons-8.7.0.dist-info}/entry_points.txt +0 -0
  40. {opentrons-8.6.0a11.dist-info → opentrons-8.7.0.dist-info}/licenses/LICENSE +0 -0
@@ -640,6 +640,9 @@ class Labware:
640
640
  lid: Optional[str] = None,
641
641
  namespace: Optional[str] = None,
642
642
  version: Optional[int] = None,
643
+ *,
644
+ lid_namespace: Optional[str] = None,
645
+ lid_version: Optional[int] = None,
643
646
  ) -> Labware:
644
647
  """Load a compatible labware onto the labware using its load parameters.
645
648
 
@@ -650,6 +653,24 @@ class Labware:
650
653
 
651
654
  :returns: The initialized and loaded labware object.
652
655
  """
656
+ if self._api_version < validation.NAMESPACE_VERSION_ADAPTER_LID_VERSION_GATE:
657
+ if lid_namespace is not None:
658
+ raise APIVersionError(
659
+ api_element="The `lid_namespace` parameter",
660
+ until_version=str(
661
+ validation.NAMESPACE_VERSION_ADAPTER_LID_VERSION_GATE
662
+ ),
663
+ current_version=str(self._api_version),
664
+ )
665
+ if lid_version is not None:
666
+ raise APIVersionError(
667
+ api_element="The `lid_version` parameter",
668
+ until_version=str(
669
+ validation.NAMESPACE_VERSION_ADAPTER_LID_VERSION_GATE
670
+ ),
671
+ current_version=str(self._api_version),
672
+ )
673
+
653
674
  labware_core = self._protocol_core.load_labware(
654
675
  load_name=name,
655
676
  label=label,
@@ -674,11 +695,24 @@ class Labware:
674
695
  until_version="2.23",
675
696
  current_version=f"{self._api_version}",
676
697
  )
698
+ if (
699
+ self._api_version
700
+ < validation.NAMESPACE_VERSION_ADAPTER_LID_VERSION_GATE
701
+ ):
702
+ checked_lid_namespace = namespace
703
+ checked_lid_version = version
704
+ else:
705
+ # This is currently impossible to reach because of the
706
+ # `if self._api_version < validation.validation.LID_STACK_VERSION_GATE`
707
+ # check above. This is here for now in case that check is removed in
708
+ # the future, and for symmetry with the other labware load methods.
709
+ checked_lid_namespace = lid_namespace
710
+ checked_lid_version = lid_version
677
711
  self._protocol_core.load_lid(
678
712
  load_name=lid,
679
713
  location=labware_core,
680
- namespace=namespace,
681
- version=version,
714
+ namespace=checked_lid_namespace,
715
+ version=checked_lid_version,
682
716
  )
683
717
 
684
718
  return labware
@@ -123,7 +123,7 @@ class ModuleContext(CommandPublisher):
123
123
 
124
124
  return core.geometry.add_labware(labware)
125
125
 
126
- def load_labware(
126
+ def load_labware( # noqa: C901
127
127
  self,
128
128
  name: str,
129
129
  label: Optional[str] = None,
@@ -131,6 +131,11 @@ class ModuleContext(CommandPublisher):
131
131
  version: Optional[int] = None,
132
132
  adapter: Optional[str] = None,
133
133
  lid: Optional[str] = None,
134
+ *,
135
+ adapter_namespace: Optional[str] = None,
136
+ adapter_version: Optional[int] = None,
137
+ lid_namespace: Optional[str] = None,
138
+ lid_version: Optional[int] = None,
134
139
  ) -> Labware:
135
140
  """Load a labware onto the module using its load parameters.
136
141
 
@@ -142,7 +147,11 @@ class ModuleContext(CommandPublisher):
142
147
  :returns: The initialized and loaded labware object.
143
148
 
144
149
  .. versionadded:: 2.1
145
- The *label,* *namespace,* and *version* parameters.
150
+ The ``label``, ``namespace``, and ``version`` parameters.
151
+
152
+ .. versionadded:: 2.26
153
+ The ``adapter_namespace``, ``adapter_version``,
154
+ ``lid_namespace``, and ``lid_version`` parameters.
146
155
  """
147
156
  if self._api_version < APIVersion(2, 1) and (
148
157
  label is not None or namespace is not None or version != 1
@@ -152,6 +161,40 @@ class ModuleContext(CommandPublisher):
152
161
  "are trying to utilize new load_labware parameters in 2.1"
153
162
  )
154
163
 
164
+ if self._api_version < validation.NAMESPACE_VERSION_ADAPTER_LID_VERSION_GATE:
165
+ if adapter_namespace is not None:
166
+ raise APIVersionError(
167
+ api_element="The `adapter_namespace` parameter",
168
+ until_version=str(
169
+ validation.NAMESPACE_VERSION_ADAPTER_LID_VERSION_GATE
170
+ ),
171
+ current_version=str(self._api_version),
172
+ )
173
+ if adapter_version is not None:
174
+ raise APIVersionError(
175
+ api_element="The `adapter_version` parameter",
176
+ until_version=str(
177
+ validation.NAMESPACE_VERSION_ADAPTER_LID_VERSION_GATE
178
+ ),
179
+ current_version=str(self._api_version),
180
+ )
181
+ if lid_namespace is not None:
182
+ raise APIVersionError(
183
+ api_element="The `lid_namespace` parameter",
184
+ until_version=str(
185
+ validation.NAMESPACE_VERSION_ADAPTER_LID_VERSION_GATE
186
+ ),
187
+ current_version=str(self._api_version),
188
+ )
189
+ if lid_version is not None:
190
+ raise APIVersionError(
191
+ api_element="The `lid_version` parameter",
192
+ until_version=str(
193
+ validation.NAMESPACE_VERSION_ADAPTER_LID_VERSION_GATE
194
+ ),
195
+ current_version=str(self._api_version),
196
+ )
197
+
155
198
  load_location: Union[ModuleCore, LabwareCore]
156
199
  if adapter is not None:
157
200
  if self._api_version < APIVersion(2, 15):
@@ -160,9 +203,21 @@ class ModuleContext(CommandPublisher):
160
203
  until_version="2.15",
161
204
  current_version=f"{self._api_version}",
162
205
  )
206
+
207
+ if (
208
+ self._api_version
209
+ < validation.NAMESPACE_VERSION_ADAPTER_LID_VERSION_GATE
210
+ ):
211
+ checked_adapter_namespace = namespace
212
+ checked_adapter_version = None
213
+ else:
214
+ checked_adapter_namespace = adapter_namespace
215
+ checked_adapter_version = adapter_version
216
+
163
217
  loaded_adapter = self.load_adapter(
164
218
  name=adapter,
165
- namespace=namespace,
219
+ namespace=checked_adapter_namespace,
220
+ version=checked_adapter_version,
166
221
  )
167
222
  load_location = loaded_adapter._core
168
223
  else:
@@ -193,11 +248,22 @@ class ModuleContext(CommandPublisher):
193
248
  until_version="2.23",
194
249
  current_version=f"{self._api_version}",
195
250
  )
251
+
252
+ if (
253
+ self._api_version
254
+ < validation.NAMESPACE_VERSION_ADAPTER_LID_VERSION_GATE
255
+ ):
256
+ checked_lid_namespace = namespace
257
+ checked_lid_version = None
258
+ else:
259
+ checked_lid_namespace = lid_namespace
260
+ checked_lid_version = lid_version
261
+
196
262
  self._protocol_core.load_lid(
197
263
  load_name=lid,
198
264
  location=labware_core,
199
- namespace=namespace,
200
- version=version,
265
+ namespace=checked_lid_namespace,
266
+ version=checked_lid_version,
201
267
  )
202
268
 
203
269
  if isinstance(self._core, LegacyModuleCore):
@@ -1272,7 +1338,7 @@ class FlexStackerContext(ModuleContext):
1272
1338
  def set_stored_labware_items(
1273
1339
  self,
1274
1340
  labware: list[Labware],
1275
- stacking_offset_z: float | None,
1341
+ stacking_offset_z: float | None = None,
1276
1342
  ) -> None:
1277
1343
  """Configure the labware the Flex Stacker will store during a protocol by providing an initial list of stored labware objects. The start of the list represents the bottom of the Stacker,
1278
1344
  and the end of the list represents the top of the Stacker.
@@ -1330,6 +1396,11 @@ class FlexStackerContext(ModuleContext):
1330
1396
  lid: str | None = None,
1331
1397
  count: int | None = None,
1332
1398
  stacking_offset_z: float | None = None,
1399
+ *,
1400
+ adapter_namespace: str | None = None,
1401
+ adapter_version: int | None = None,
1402
+ lid_namespace: str | None = None,
1403
+ lid_version: int | None = None,
1333
1404
  ) -> None:
1334
1405
  """Configure the type and starting quantity of labware the Flex Stacker will store during a protocol. This is the only type of labware you'll be able to store in the Stacker until it's reconfigured.
1335
1406
 
@@ -1338,6 +1409,7 @@ class FlexStackerContext(ModuleContext):
1338
1409
  :param str load_name: A string to use for looking up a labware definition.
1339
1410
  You can find the ``load_name`` for any Opentrons-verified labware on the
1340
1411
  `Labware Library <https://labware.opentrons.com>`__.
1412
+
1341
1413
  :param str namespace: The namespace that the labware definition belongs to.
1342
1414
  If unspecified, the API will automatically search two namespaces:
1343
1415
 
@@ -1348,19 +1420,34 @@ class FlexStackerContext(ModuleContext):
1348
1420
  You might need to specify an explicit ``namespace`` if you have a custom
1349
1421
  definition whose ``load_name`` is the same as an Opentrons-verified
1350
1422
  definition, and you want to explicitly choose one or the other.
1423
+
1351
1424
  :param version: The version of the labware definition. You should normally
1352
1425
  leave this unspecified to let the method choose a version
1353
1426
  automatically.
1427
+
1354
1428
  :param adapter: An adapter to load the labware on top of. Accepts the same
1355
- values as the ``load_name`` parameter of :py:meth:`.load_adapter`. The
1356
- adapter will use the same namespace as the labware, and the API will
1357
- choose the adapter's version automatically.
1429
+ values as the ``load_name`` parameter of :py:meth:`.load_adapter`.
1430
+
1431
+ :param adapter_namespace: Applies to ``adapter`` the same way that ``namespace``
1432
+ applies to ``load_name``.
1433
+
1434
+ :param adapter_version: Applies to ``adapter`` the same way that ``version``
1435
+ applies to ``load_name``.
1436
+
1358
1437
  :param lid: A lid to load the on top of the main labware. Accepts the same
1359
1438
  values as the ``load_name`` parameter of :py:meth:`~.ProtocolContext.load_lid_stack`. The
1360
1439
  lid will use the same namespace as the labware, and the API will
1361
1440
  choose the lid's version automatically.
1441
+
1442
+ :param lid_namespace: Applies to ``lid`` the same way that ``namespace``
1443
+ applies to ``load_name``.
1444
+
1445
+ :param lid_version: Applies to ``lid`` the same way that ``version``
1446
+ applies to ``load_name``.
1447
+
1362
1448
  :param count: The number of labware that the Flex Stacker should store. If not specified, this will be the maximum amount of this kind of
1363
1449
  labware that the Flex Stacker is capable of storing.
1450
+
1364
1451
  :param stacking_offset_z: Stacking ``z`` offset in mm of stored labware. If specified, this overrides the
1365
1452
  calculated value in the labware definition.
1366
1453
 
@@ -1378,18 +1465,63 @@ class FlexStackerContext(ModuleContext):
1378
1465
  - Labware on adapter: the adapter (bottom side) of the upper labware unit overlaps with the top side of the labware below.
1379
1466
  - Labware with lid: the labware (bottom side) of the upper labware unit overlaps with the lid (top side) of the unit below.
1380
1467
  - Labware with lid and adapter: the adapter (bottom side) of the upper labware unit overlaps with the lid (top side) of the unit below.
1381
-
1382
1468
  """
1469
+
1470
+ if self._api_version < validation.NAMESPACE_VERSION_ADAPTER_LID_VERSION_GATE:
1471
+ if adapter_namespace is not None:
1472
+ raise APIVersionError(
1473
+ api_element="The `adapter_namespace` parameter",
1474
+ until_version=str(
1475
+ validation.NAMESPACE_VERSION_ADAPTER_LID_VERSION_GATE
1476
+ ),
1477
+ current_version=str(self._api_version),
1478
+ )
1479
+ if adapter_version is not None:
1480
+ raise APIVersionError(
1481
+ api_element="The `adapter_version` parameter",
1482
+ until_version=str(
1483
+ validation.NAMESPACE_VERSION_ADAPTER_LID_VERSION_GATE
1484
+ ),
1485
+ current_version=str(self._api_version),
1486
+ )
1487
+ if lid_namespace is not None:
1488
+ raise APIVersionError(
1489
+ api_element="The `lid_namespace` parameter",
1490
+ until_version=str(
1491
+ validation.NAMESPACE_VERSION_ADAPTER_LID_VERSION_GATE
1492
+ ),
1493
+ current_version=str(self._api_version),
1494
+ )
1495
+ if lid_version is not None:
1496
+ raise APIVersionError(
1497
+ api_element="The `lid_version` parameter",
1498
+ until_version=str(
1499
+ validation.NAMESPACE_VERSION_ADAPTER_LID_VERSION_GATE
1500
+ ),
1501
+ current_version=str(self._api_version),
1502
+ )
1503
+
1504
+ if self._api_version < validation.NAMESPACE_VERSION_ADAPTER_LID_VERSION_GATE:
1505
+ checked_adapter_namespace = namespace
1506
+ checked_adapter_version = version
1507
+ checked_lid_namespace = namespace
1508
+ checked_lid_version = version
1509
+ else:
1510
+ checked_adapter_namespace = adapter_namespace
1511
+ checked_adapter_version = adapter_version
1512
+ checked_lid_namespace = lid_namespace
1513
+ checked_lid_version = lid_version
1514
+
1383
1515
  self._core.set_stored_labware(
1384
1516
  main_load_name=load_name,
1385
1517
  main_namespace=namespace,
1386
1518
  main_version=version,
1387
1519
  lid_load_name=lid,
1388
- lid_namespace=namespace,
1389
- lid_version=version,
1520
+ lid_namespace=checked_lid_namespace,
1521
+ lid_version=checked_lid_version,
1390
1522
  adapter_load_name=adapter,
1391
- adapter_namespace=namespace,
1392
- adapter_version=version,
1523
+ adapter_namespace=checked_adapter_namespace,
1524
+ adapter_version=checked_adapter_version,
1393
1525
  count=count,
1394
1526
  stacking_offset_z=stacking_offset_z,
1395
1527
  )
@@ -405,7 +405,7 @@ class ProtocolContext(CommandPublisher):
405
405
  )
406
406
 
407
407
  @requires_version(2, 0)
408
- def load_labware(
408
+ def load_labware( # noqa: C901
409
409
  self,
410
410
  load_name: str,
411
411
  location: Union[DeckLocation, OffDeckType],
@@ -414,6 +414,11 @@ class ProtocolContext(CommandPublisher):
414
414
  version: Optional[int] = None,
415
415
  adapter: Optional[str] = None,
416
416
  lid: Optional[str] = None,
417
+ *,
418
+ adapter_namespace: Optional[str] = None,
419
+ adapter_version: Optional[int] = None,
420
+ lid_namespace: Optional[str] = None,
421
+ lid_version: Optional[int] = None,
417
422
  ) -> Labware:
418
423
  """Load a labware onto a location.
419
424
 
@@ -454,18 +459,52 @@ class ProtocolContext(CommandPublisher):
454
459
  :param version: The version of the labware definition. You should normally
455
460
  leave this unspecified to let ``load_labware()`` choose a version
456
461
  automatically.
457
- :param adapter: An adapter to load the labware on top of. Accepts the same
458
- values as the ``load_name`` parameter of :py:meth:`.load_adapter`. The
459
- adapter will use the same namespace as the labware, and the API will
460
- choose the adapter's version automatically.
461
462
 
462
- .. versionadded:: 2.15
463
+ :param adapter: The load name of an adapter to load the labware on top of. Accepts
464
+ the same values as the ``load_name`` parameter of :py:meth:`.load_adapter`.
465
+
466
+ .. versionadded:: 2.15
467
+
468
+ :param adapter_namespace: The namespace of the adapter being loaded.
469
+ Applies to ``adapter`` the same way that ``namespace`` applies to ``load_name``.
470
+
471
+ .. versionchanged:: 2.26
472
+ ``adapter_namespace`` may now be specified explicitly.
473
+ Also, when you've specified ``namespace`` but not ``adapter_namespace``,
474
+ ``adapter_namespace`` will now independently follow the same search rules
475
+ described in ``namespace``. Formerly, it took ``namespace``'s exact value.
476
+
477
+ :param adapter_version: The version of the adapter being loaded.
478
+ Applies to ``adapter`` the same way that ``version`` applies to ``load_name``.
479
+
480
+ .. versionchanged:: 2.26
481
+ ``adapter_version`` may now be specified explicitly. Also, when it's unspecified,
482
+ the algorithm to select a version automatically has improved to avoid
483
+ selecting versions that do not exist.
484
+
463
485
  :param lid: A lid to load on the top of the main labware. Accepts the same
464
486
  values as the ``load_name`` parameter of :py:meth:`.load_lid_stack`. The
465
487
  lid will use the same namespace as the labware, and the API will
466
488
  choose the lid's version automatically.
467
489
 
468
- .. versionadded:: 2.23
490
+ .. versionadded:: 2.23
491
+
492
+ :param lid_namespace: The namespace of the lid being loaded.
493
+ Applies to ``lid`` the same way that ``namespace`` applies to ``load_name``.
494
+
495
+ .. versionchanged:: 2.26
496
+ ``lid_namespace`` may now be specified explicitly.
497
+ Also, when you've specified ``namespace`` but not ``lid_namespace``,
498
+ ``lid_namespace`` will now independently follow the same search rules
499
+ described in ``namespace``. Formerly, it took ``namespace``'s exact value.
500
+
501
+ :param lid_version: The version of the adapter being loaded.
502
+ Applies to ``lid`` the same way that ``version`` applies to ``load_name``.
503
+
504
+ .. versionchanged:: 2.26
505
+ ``lid_version`` may now be specified explicitly. Also, when it's unspecified,
506
+ the algorithm to select a version automatically has improved to avoid
507
+ selecting versions that do not exist.
469
508
  """
470
509
 
471
510
  if isinstance(location, OffDeckType) and self._api_version < APIVersion(2, 15):
@@ -475,6 +514,40 @@ class ProtocolContext(CommandPublisher):
475
514
  current_version=f"{self._api_version}",
476
515
  )
477
516
 
517
+ if self._api_version < validation.NAMESPACE_VERSION_ADAPTER_LID_VERSION_GATE:
518
+ if adapter_namespace is not None:
519
+ raise APIVersionError(
520
+ api_element="The `adapter_namespace` parameter",
521
+ until_version=str(
522
+ validation.NAMESPACE_VERSION_ADAPTER_LID_VERSION_GATE
523
+ ),
524
+ current_version=str(self._api_version),
525
+ )
526
+ if adapter_version is not None:
527
+ raise APIVersionError(
528
+ api_element="The `adapter_version` parameter",
529
+ until_version=str(
530
+ validation.NAMESPACE_VERSION_ADAPTER_LID_VERSION_GATE
531
+ ),
532
+ current_version=str(self._api_version),
533
+ )
534
+ if lid_namespace is not None:
535
+ raise APIVersionError(
536
+ api_element="The `lid_namespace` parameter",
537
+ until_version=str(
538
+ validation.NAMESPACE_VERSION_ADAPTER_LID_VERSION_GATE
539
+ ),
540
+ current_version=str(self._api_version),
541
+ )
542
+ if lid_version is not None:
543
+ raise APIVersionError(
544
+ api_element="The `lid_version` parameter",
545
+ until_version=str(
546
+ validation.NAMESPACE_VERSION_ADAPTER_LID_VERSION_GATE
547
+ ),
548
+ current_version=str(self._api_version),
549
+ )
550
+
478
551
  load_name = validation.ensure_lowercase_name(load_name)
479
552
  load_location: Union[OffDeckType, DeckSlotName, StagingSlotName, LabwareCore]
480
553
  if adapter is not None:
@@ -484,10 +557,22 @@ class ProtocolContext(CommandPublisher):
484
557
  until_version="2.15",
485
558
  current_version=f"{self._api_version}",
486
559
  )
560
+
561
+ if (
562
+ self._api_version
563
+ < validation.NAMESPACE_VERSION_ADAPTER_LID_VERSION_GATE
564
+ ):
565
+ checked_adapter_namespace = namespace
566
+ checked_adapter_version = None
567
+ else:
568
+ checked_adapter_namespace = adapter_namespace
569
+ checked_adapter_version = adapter_version
570
+
487
571
  loaded_adapter = self.load_adapter(
488
572
  load_name=adapter,
489
573
  location=location,
490
- namespace=namespace,
574
+ namespace=checked_adapter_namespace,
575
+ version=checked_adapter_version,
491
576
  )
492
577
  load_location = loaded_adapter._core
493
578
  elif isinstance(location, OffDeckType):
@@ -512,11 +597,22 @@ class ProtocolContext(CommandPublisher):
512
597
  until_version=f"{validation.LID_STACK_VERSION_GATE}",
513
598
  current_version=f"{self._api_version}",
514
599
  )
600
+
601
+ if (
602
+ self._api_version
603
+ < validation.NAMESPACE_VERSION_ADAPTER_LID_VERSION_GATE
604
+ ):
605
+ checked_lid_namespace = namespace
606
+ checked_lid_version = version
607
+ else:
608
+ checked_lid_namespace = lid_namespace
609
+ checked_lid_version = lid_version
610
+
515
611
  self._core.load_lid(
516
612
  load_name=lid,
517
613
  location=labware_core,
518
- namespace=namespace,
519
- version=version,
614
+ namespace=checked_lid_namespace,
615
+ version=checked_lid_version,
520
616
  )
521
617
 
522
618
  labware = Labware(
@@ -1377,6 +1473,7 @@ class ProtocolContext(CommandPublisher):
1377
1473
  def get_liquid_class(
1378
1474
  self,
1379
1475
  name: str,
1476
+ version: Optional[int] = None,
1380
1477
  ) -> LiquidClass:
1381
1478
  """
1382
1479
  Get an instance of an Opentrons-verified liquid class for use in a Flex protocol.
@@ -1386,12 +1483,14 @@ class ProtocolContext(CommandPublisher):
1386
1483
  - ``"water"``: an Opentrons-verified liquid class based on deionized water.
1387
1484
  - ``"glycerol_50"``: an Opentrons-verified liquid class for viscous liquid. Based on 50% glycerol.
1388
1485
  - ``"ethanol_80"``: an Opentrons-verified liquid class for volatile liquid. Based on 80% ethanol.
1486
+ :param version: The version of the liquid class to retrieve. If left unspecified, the latest definition for the
1487
+ protocol's API version will be loaded.
1389
1488
 
1390
1489
  :raises: ``LiquidClassDefinitionDoesNotExist``: if the specified liquid class does not exist.
1391
1490
 
1392
1491
  :returns: A new LiquidClass object.
1393
1492
  """
1394
- return self._core.get_liquid_class(name=name, version=DEFAULT_LC_VERSION)
1493
+ return self._core.get_liquid_class(name=name, version=version)
1395
1494
 
1396
1495
  @requires_version(2, 24)
1397
1496
  def define_liquid_class(
@@ -1461,6 +1560,9 @@ class ProtocolContext(CommandPublisher):
1461
1560
  adapter: Optional[str] = None,
1462
1561
  namespace: Optional[str] = None,
1463
1562
  version: Optional[int] = None,
1563
+ *,
1564
+ adapter_namespace: Optional[str] = None,
1565
+ adapter_version: Optional[int] = None,
1464
1566
  ) -> Labware:
1465
1567
  """
1466
1568
  Load a stack of Opentrons Tough Auto-Sealing Lids onto a valid deck location or adapter.
@@ -1468,13 +1570,17 @@ class ProtocolContext(CommandPublisher):
1468
1570
  :param str load_name: A string to use for looking up a lid definition.
1469
1571
  You can find the ``load_name`` for any compatible lid on the Opentrons
1470
1572
  `Labware Library <https://labware.opentrons.com>`_.
1573
+
1471
1574
  :param location: Either a :ref:`deck slot <deck-slots>`,
1472
1575
  like ``1``, ``"1"``, or ``"D1"``, or a valid Opentrons Adapter.
1576
+
1473
1577
  :param int quantity: The quantity of lids to be loaded in the stack.
1578
+
1474
1579
  :param adapter: An adapter to load the lid stack on top of. Accepts the same
1475
1580
  values as the ``load_name`` parameter of :py:meth:`.load_adapter`. The
1476
1581
  adapter will use the same namespace as the lid labware, and the API will
1477
1582
  choose the adapter's version automatically.
1583
+
1478
1584
  :param str namespace: The namespace that the lid labware definition belongs to.
1479
1585
  If unspecified, the API will automatically search two namespaces:
1480
1586
 
@@ -1490,6 +1596,21 @@ class ProtocolContext(CommandPublisher):
1490
1596
  leave this unspecified to let ``load_lid_stack()`` choose a version
1491
1597
  automatically.
1492
1598
 
1599
+ :param adapter_namespace: The namespace of the adapter being loaded.
1600
+ Applies to ``adapter`` the same way that ``namespace`` applies to ``load_name``.
1601
+
1602
+ .. versionchanged:: 2.26
1603
+ ``adapter_namespace`` may now be specified explicitly.
1604
+ Also, when you've specified ``namespace`` but not ``adapter_namespace``,
1605
+ ``adapter_namespace`` will now independently follow the same search rules
1606
+ described in ``namespace``. Formerly, it took ``namespace``'s exact value.
1607
+
1608
+ :param adapter_version: The version of the adapter being loaded.
1609
+ Applies to ``adapter`` the same way that ``version`` applies to ``load_name``.
1610
+
1611
+ .. versionadded:: 2.26
1612
+ ``adapter_version`` may now be specified explicitly.
1613
+
1493
1614
  :return: The initialized and loaded labware object representing the lid stack.
1494
1615
 
1495
1616
  .. versionadded:: 2.23
@@ -1502,6 +1623,24 @@ class ProtocolContext(CommandPublisher):
1502
1623
  current_version=f"{self._api_version}",
1503
1624
  )
1504
1625
 
1626
+ if self._api_version < validation.NAMESPACE_VERSION_ADAPTER_LID_VERSION_GATE:
1627
+ if adapter_namespace is not None:
1628
+ raise APIVersionError(
1629
+ api_element="The `adapter_namespace` parameter",
1630
+ until_version=str(
1631
+ validation.NAMESPACE_VERSION_ADAPTER_LID_VERSION_GATE
1632
+ ),
1633
+ current_version=str(self._api_version),
1634
+ )
1635
+ if adapter_version is not None:
1636
+ raise APIVersionError(
1637
+ api_element="The `adapter_version` parameter",
1638
+ until_version=str(
1639
+ validation.NAMESPACE_VERSION_ADAPTER_LID_VERSION_GATE
1640
+ ),
1641
+ current_version=str(self._api_version),
1642
+ )
1643
+
1505
1644
  load_location: Union[DeckSlotName, StagingSlotName, LabwareCore]
1506
1645
  if isinstance(location, Labware):
1507
1646
  load_location = location._core
@@ -1514,10 +1653,21 @@ class ProtocolContext(CommandPublisher):
1514
1653
  if isinstance(load_location, DeckSlotName) or isinstance(
1515
1654
  load_location, StagingSlotName
1516
1655
  ):
1656
+ if (
1657
+ self._api_version
1658
+ < validation.NAMESPACE_VERSION_ADAPTER_LID_VERSION_GATE
1659
+ ):
1660
+ checked_adapter_namespace = namespace
1661
+ checked_adapter_version = None
1662
+ else:
1663
+ checked_adapter_namespace = adapter_namespace
1664
+ checked_adapter_version = adapter_version
1665
+
1517
1666
  loaded_adapter = self.load_adapter(
1518
1667
  load_name=adapter,
1519
1668
  location=load_location.value,
1520
- namespace=namespace,
1669
+ namespace=checked_adapter_namespace,
1670
+ version=checked_adapter_version,
1521
1671
  )
1522
1672
  load_location = loaded_adapter._core
1523
1673
  else:
@@ -62,6 +62,10 @@ LID_STACK_VERSION_GATE = APIVersion(2, 23)
62
62
  # The first APIVersion where Python protocols can use the Flex Stacker module.
63
63
  FLEX_STACKER_VERSION_GATE = APIVersion(2, 23)
64
64
 
65
+ # The first APIVersion where various "multi labware load" methods allow you to specify
66
+ # the namespace and version of adapters and lids separately from the main labware.
67
+ NAMESPACE_VERSION_ADAPTER_LID_VERSION_GATE = APIVersion(2, 26)
68
+
65
69
 
66
70
  class InvalidPipetteMountError(ValueError):
67
71
  """An error raised when attempting to load pipettes on an invalid mount."""
@@ -20,6 +20,7 @@ from .flex_stacker.common import (
20
20
  FlexStackerHopperError,
21
21
  FlexStackerLabwareRetrieveError,
22
22
  FlexStackerShuttleOccupiedError,
23
+ FlexStackerLabwareStoreError,
23
24
  )
24
25
 
25
26
  from . import absorbance_reader
@@ -948,6 +949,7 @@ CommandDefinedErrorData = Union[
948
949
  DefinedErrorData[FlexStackerHopperError],
949
950
  DefinedErrorData[FlexStackerLabwareRetrieveError],
950
951
  DefinedErrorData[FlexStackerShuttleOccupiedError],
952
+ DefinedErrorData[FlexStackerLabwareStoreError],
951
953
  ]
952
954
 
953
955
 
@@ -148,6 +148,19 @@ class FlexStackerLabwareRetrieveError(ErrorOccurrence):
148
148
  errorInfo: FailedLabware
149
149
 
150
150
 
151
+ class FlexStackerLabwareStoreError(ErrorOccurrence):
152
+ """Returned when the labware was not able to get to the shuttle."""
153
+
154
+ isDefined: bool = True
155
+ errorType: Literal[
156
+ "flexStackerLabwareStoreFailed"
157
+ ] = "flexStackerLabwareStoreFailed"
158
+
159
+ errorCode: str = ErrorCodes.STACKER_SHUTTLE_LABWARE_FAILED.value.code
160
+ detail: str = ErrorCodes.STACKER_SHUTTLE_LABWARE_FAILED.value.detail
161
+ errorInfo: FailedLabware
162
+
163
+
151
164
  class FlexStackerShuttleOccupiedError(ErrorOccurrence):
152
165
  """Returned when the Flex Stacker Shuttle is occupied when it shouldn't be."""
153
166