diff --git a/api/docs/v2/deck_slots.rst b/api/docs/v2/deck_slots.rst index 6441ab0d562..097bf03547a 100644 --- a/api/docs/v2/deck_slots.rst +++ b/api/docs/v2/deck_slots.rst @@ -36,7 +36,7 @@ For example, these two ``load_labware()`` commands are equivalent: .. code-block:: python - protocol.load_labware("nest_96_wellplate_200ul_flat", "A1") + protocol.load_labware("nest_96_wellplate_200ul_flat", "A1", None) .. versionadded:: 2.15 diff --git a/api/src/opentrons/protocol_api/core/engine/protocol.py b/api/src/opentrons/protocol_api/core/engine/protocol.py index 07b417594cb..ba8ac7d69f6 100644 --- a/api/src/opentrons/protocol_api/core/engine/protocol.py +++ b/api/src/opentrons/protocol_api/core/engine/protocol.py @@ -210,8 +210,8 @@ def load_labware( ], label: Optional[str], namespace: Optional[str], - version: Optional[int] = None, - schema: Optional[int] = 2, + version: Optional[int], + schema: Optional[int], ) -> LabwareCore: """Load a labware using its identifying parameters.""" load_location = self._convert_labware_location(location=location) diff --git a/api/src/opentrons/protocol_api/core/legacy/legacy_protocol_core.py b/api/src/opentrons/protocol_api/core/legacy/legacy_protocol_core.py index 4de0b96dd3a..30f5db2d992 100644 --- a/api/src/opentrons/protocol_api/core/legacy/legacy_protocol_core.py +++ b/api/src/opentrons/protocol_api/core/legacy/legacy_protocol_core.py @@ -175,8 +175,8 @@ def load_labware( ], label: Optional[str], namespace: Optional[str], - version: Optional[int] = None, - schema: Optional[int] = 2, + version: Optional[int], + schema: Optional[int], ) -> LegacyLabwareCore: """Load a labware using its identifying parameters.""" if isinstance(location, OffDeckType): diff --git a/api/src/opentrons/protocol_api/core/protocol.py b/api/src/opentrons/protocol_api/core/protocol.py index 44d47eb2e19..10c8ca992dc 100644 --- a/api/src/opentrons/protocol_api/core/protocol.py +++ b/api/src/opentrons/protocol_api/core/protocol.py @@ -84,8 +84,8 @@ def load_labware( ], label: Optional[str], namespace: Optional[str], - version: Optional[int] = None, - schema: Optional[int] = 2, + version: Optional[int], + schema: Optional[int], ) -> LabwareCoreType: """Load a labware using its identifying parameters.""" ... diff --git a/api/src/opentrons/protocol_api/module_contexts.py b/api/src/opentrons/protocol_api/module_contexts.py index 614bb4f53c7..bb9ad2bfbdd 100644 --- a/api/src/opentrons/protocol_api/module_contexts.py +++ b/api/src/opentrons/protocol_api/module_contexts.py @@ -126,6 +126,7 @@ def load_labware( version: Optional[int] = None, adapter: Optional[str] = None, lid: Optional[str] = None, + schema: Optional[int] = None, ) -> Labware: """Load a labware onto the module using its load parameters. @@ -180,6 +181,7 @@ def load_labware( namespace=namespace, version=version, location=load_location, + schema=schema, ) if lid is not None: if self._api_version < validation.LID_STACK_VERSION_GATE: diff --git a/api/src/opentrons/protocol_api/protocol_context.py b/api/src/opentrons/protocol_api/protocol_context.py index b9f96e4d536..b0c815dde4f 100644 --- a/api/src/opentrons/protocol_api/protocol_context.py +++ b/api/src/opentrons/protocol_api/protocol_context.py @@ -400,6 +400,7 @@ def load_labware( version: Optional[int] = None, adapter: Optional[str] = None, lid: Optional[str] = None, + schema: Optional[int] = None, ) -> Labware: """Load a labware onto a location. @@ -448,6 +449,8 @@ def load_labware( values as the ``load_name`` parameter of :py:meth:`.load_lid_stack`. The lid will use the same namespace as the labware, and the API will choose the lid's version automatically. + :param schema: If specified, the schema version that will correspond to the + labware definition to load by default. .. versionadded:: 2.15 """ @@ -486,6 +489,7 @@ def load_labware( label=label, namespace=namespace, version=version, + schema=schema, ) if lid is not None: diff --git a/api/tests/opentrons/protocol_api/core/engine/test_protocol_core.py b/api/tests/opentrons/protocol_api/core/engine/test_protocol_core.py index 2889a47cea9..cf7f2a2526d 100644 --- a/api/tests/opentrons/protocol_api/core/engine/test_protocol_core.py +++ b/api/tests/opentrons/protocol_api/core/engine/test_protocol_core.py @@ -331,6 +331,7 @@ def test_load_labware( decoy: Decoy, mock_engine_client: EngineClient, subject: ProtocolCore, + api_version: APIVersion, ) -> None: """It should issue a LoadLabware command.""" decoy.when( @@ -343,6 +344,8 @@ def test_load_labware( "a_namespace", 456, [EngineLabwareLoadParams("hello", "world", 654)], + api_version, + 2, ) ).then_return(("some_namespace", 9001)) @@ -374,6 +377,7 @@ def test_load_labware( label="some_display_name", # maps to optional display name namespace="a_namespace", version=456, + schema=2, ) assert isinstance(result, LabwareCore) @@ -405,6 +409,7 @@ def test_load_labware_on_staging_slot( decoy: Decoy, mock_engine_client: EngineClient, subject: ProtocolCore, + api_version: APIVersion, ) -> None: """It should issue a LoadLabware command for a labware on a staging slot.""" decoy.when( @@ -417,6 +422,8 @@ def test_load_labware_on_staging_slot( "a_namespace", 456, [EngineLabwareLoadParams("hello", "world", 654)], + api_version, + 3, ) ).then_return(("some_namespace", 9001)) @@ -448,6 +455,7 @@ def test_load_labware_on_staging_slot( label="some_display_name", # maps to optional display name namespace="a_namespace", version=456, + schema=3, ) assert isinstance(result, LabwareCore) @@ -479,6 +487,7 @@ def test_load_labware_on_labware( decoy: Decoy, mock_engine_client: EngineClient, subject: ProtocolCore, + api_version: APIVersion, ) -> None: """It should issue a LoadLabware command onto an OnLabware location.""" mock_labware_core = decoy.mock(cls=LabwareCore) @@ -494,6 +503,8 @@ def test_load_labware_on_labware( "a_namespace", 456, [EngineLabwareLoadParams("hello", "world", 654)], + api_version, + None, ) ).then_return(("some_namespace", 9001)) @@ -529,6 +540,7 @@ def test_load_labware_on_labware( label="some_display_name", namespace="a_namespace", version=456, + schema=None, ) assert isinstance(result, LabwareCore) @@ -552,6 +564,7 @@ def test_load_labware_off_deck( decoy: Decoy, mock_engine_client: EngineClient, subject: ProtocolCore, + api_version: APIVersion, ) -> None: """It should issue a LoadLabware off deck command.""" decoy.when( @@ -564,6 +577,8 @@ def test_load_labware_off_deck( "a_namespace", 456, [EngineLabwareLoadParams("hello", "world", 654)], + api_version, + None, ) ).then_return(("some_namespace", 9001)) @@ -595,6 +610,7 @@ def test_load_labware_off_deck( label="some_display_name", # maps to optional display name namespace="a_namespace", version=456, + schema=None, ) assert isinstance(result, LabwareCore) @@ -1189,6 +1205,8 @@ def test_load_labware_on_module( "a_namespace", 456, [EngineLabwareLoadParams("hello", "world", 654)], + api_version, + None, ) ).then_return(("some_namespace", 9001)) @@ -1227,6 +1245,7 @@ def test_load_labware_on_module( label="some_display_name", # maps to optional display name namespace="a_namespace", version=456, + schema=None, ) assert isinstance(result, LabwareCore) @@ -1266,6 +1285,8 @@ def test_load_labware_on_non_connected_module( "a_namespace", 456, [EngineLabwareLoadParams("hello", "world", 654)], + api_version, + 2, ) ).then_return(("some_namespace", 9001)) @@ -1303,6 +1324,7 @@ def test_load_labware_on_non_connected_module( label="some_display_name", # maps to optional display name namespace="a_namespace", version=456, + schema=2, ) assert isinstance(result, LabwareCore) diff --git a/api/tests/opentrons/protocol_api/core/legacy/test_protocol_context_implementation.py b/api/tests/opentrons/protocol_api/core/legacy/test_protocol_context_implementation.py index d9fcfa8e29b..bb643c610dd 100644 --- a/api/tests/opentrons/protocol_api/core/legacy/test_protocol_context_implementation.py +++ b/api/tests/opentrons/protocol_api/core/legacy/test_protocol_context_implementation.py @@ -176,6 +176,7 @@ def test_load_labware_off_deck_raises( label="cool label", namespace="cool namespace", version=1337, + schema=None, ) @@ -190,6 +191,7 @@ def test_load_labware_on_staging_slot_raises( label="cool label", namespace="cool namespace", version=1337, + schema=None, ) @@ -246,6 +248,7 @@ def test_load_labware( label="cool label", namespace="cool namespace", version=1337, + schema=None, ) assert isinstance(result, LegacyLabwareCore) @@ -347,6 +350,7 @@ def test_load_labware_on_module( label="cool label", namespace="cool namespace", version=1337, + schema=None, ) assert isinstance(result, LegacyLabwareCore) @@ -384,6 +388,7 @@ def test_load_labware_on_labware_raises( label="cool label", namespace="cool namespace", version=1337, + schema=None, ) diff --git a/api/tests/opentrons/protocol_api/test_labware.py b/api/tests/opentrons/protocol_api/test_labware.py index 5e49cd29947..c4337f310fb 100644 --- a/api/tests/opentrons/protocol_api/test_labware.py +++ b/api/tests/opentrons/protocol_api/test_labware.py @@ -132,6 +132,7 @@ def test_load_labware( namespace="a-namespace", version=123, location=mock_labware_core, + schema=None, ) ).then_return(new_mock_core) decoy.when(new_mock_core.get_well_columns()).then_return([]) @@ -141,6 +142,7 @@ def test_load_labware( label="a label", namespace="a-namespace", version=123, + schema=None, ) assert isinstance(result, Labware) @@ -175,6 +177,7 @@ def test_load_labware_from_definition( version=1337, label="a label", location=mock_labware_core, + schema=None, ) ).then_return(new_mock_core) diff --git a/api/tests/opentrons/protocol_api/test_module_context.py b/api/tests/opentrons/protocol_api/test_module_context.py index 1fb5132b59c..127b2097bbb 100644 --- a/api/tests/opentrons/protocol_api/test_module_context.py +++ b/api/tests/opentrons/protocol_api/test_module_context.py @@ -101,6 +101,7 @@ def test_load_labware( namespace="ideal", version=101, location=mock_core, + schema=None, ) ).then_return(mock_labware_core) @@ -149,6 +150,7 @@ def test_load_labware_from_definition( version=1337, label="Some Display Name", location=mock_core, + schema=None, ) ).then_return(mock_labware_core) @@ -265,6 +267,7 @@ def test_load_labware_with_adapter( namespace="ideal", version=101, location=mock_adapter_core, + schema=None, ) ).then_return(mock_labware_core) diff --git a/api/tests/opentrons/protocol_api/test_protocol_context.py b/api/tests/opentrons/protocol_api/test_protocol_context.py index 80728b7820c..514d8dcbd35 100644 --- a/api/tests/opentrons/protocol_api/test_protocol_context.py +++ b/api/tests/opentrons/protocol_api/test_protocol_context.py @@ -431,6 +431,7 @@ def test_load_labware( label="some_display_name", namespace="some_namespace", version=1337, + schema=2, ) ).then_return(mock_labware_core) @@ -444,6 +445,7 @@ def test_load_labware( label="some_display_name", namespace="some_namespace", version=1337, + schema=2, ) assert isinstance(result, Labware) @@ -472,6 +474,7 @@ def test_load_labware_off_deck( label="some_display_name", namespace="some_namespace", version=1337, + schema=None, ) ).then_return(mock_labware_core) @@ -533,6 +536,7 @@ def test_load_labware_on_staging_slot( label="some_display_name", namespace="some_namespace", version=1337, + schema=None, ) ).then_return(mock_labware_core) @@ -585,6 +589,7 @@ def test_load_labware_from_definition( version=1337, location=DeckSlotName.SLOT_1, label="Some Display Name", + schema=None, ) ).then_return(mock_labware_core) @@ -720,6 +725,7 @@ def test_load_labware_on_adapter( label="some_display_name", namespace="some_namespace", version=1337, + schema=None, ) ).then_return(mock_labware_core) @@ -773,6 +779,7 @@ def test_load_labware_with_lid( label="some_display_name", namespace="some_namespace", version=1337, + schema=None, ) ).then_return(mock_labware_core) decoy.when(mock_lid_core.get_well_columns()).then_return([])