diff --git a/api/.flake8 b/api/.flake8 index d654020fa7f..ee1a726e611 100644 --- a/api/.flake8 +++ b/api/.flake8 @@ -33,7 +33,7 @@ per-file-ignores = src/opentrons/simulate.py:ANN,D src/opentrons/types.py:ANN,D src/opentrons/calibration_storage/*:ANN,D - src/opentrons/commands/*:D + src/opentrons/legacy_commands/*:D src/opentrons/config/*:ANN,D src/opentrons/drivers/*:ANN,D src/opentrons/hardware_control/*:ANN,D @@ -51,7 +51,7 @@ per-file-ignores = tests/opentrons/test_types.py:ANN,D tests/opentrons/conftest.py:ANN,D tests/opentrons/calibration_storage/*:ANN,D - tests/opentrons/commands/*:ANN,D + tests/opentrons/legacy_commands/*:ANN,D tests/opentrons/config/*:ANN,D tests/opentrons/data/*:ANN,D tests/opentrons/drivers/*:ANN,D diff --git a/api/src/opentrons/execute.py b/api/src/opentrons/execute.py index a35f4a91d8d..e851d8a44f0 100644 --- a/api/src/opentrons/execute.py +++ b/api/src/opentrons/execute.py @@ -28,7 +28,7 @@ from opentrons import protocol_api, __version__, should_use_ot3 -from opentrons.commands import types as command_types +from opentrons.legacy_commands import types as command_types from opentrons.hardware_control import ( API as OT2API, @@ -333,7 +333,7 @@ def execute( # noqa: C901 'text': string_command_text, # The rest of this struct is # command-dependent; see - # opentrons.commands.commands. + # opentrons.legacy_commands.commands. } } diff --git a/api/src/opentrons/legacy_broker.py b/api/src/opentrons/legacy_broker.py index 838a75b7759..b58a779134e 100644 --- a/api/src/opentrons/legacy_broker.py +++ b/api/src/opentrons/legacy_broker.py @@ -5,7 +5,7 @@ from typing import Callable, Dict, List from typing_extensions import Literal -from opentrons.commands import types +from opentrons.legacy_commands import types MODULE_LOG = logging.getLogger(__name__) @@ -16,7 +16,7 @@ class LegacyBroker: Deprecated: Use the newer, more generic `opentrons.utils.Broker` class instead. - This class is coupled to old types from `opentrons.commands`. + This class is coupled to old types from `opentrons.legacy_commands`. https://opentrons.atlassian.net/browse/RSS-270 """ diff --git a/api/src/opentrons/legacy_commands/__init__.py b/api/src/opentrons/legacy_commands/__init__.py new file mode 100644 index 00000000000..558ad9b87c0 --- /dev/null +++ b/api/src/opentrons/legacy_commands/__init__.py @@ -0,0 +1 @@ +"""Command models from before v5.0, before Protocol Engine.""" diff --git a/api/src/opentrons/commands/commands.py b/api/src/opentrons/legacy_commands/commands.py similarity index 100% rename from api/src/opentrons/commands/commands.py rename to api/src/opentrons/legacy_commands/commands.py diff --git a/api/src/opentrons/commands/helpers.py b/api/src/opentrons/legacy_commands/helpers.py similarity index 100% rename from api/src/opentrons/commands/helpers.py rename to api/src/opentrons/legacy_commands/helpers.py diff --git a/api/src/opentrons/commands/module_commands.py b/api/src/opentrons/legacy_commands/module_commands.py similarity index 100% rename from api/src/opentrons/commands/module_commands.py rename to api/src/opentrons/legacy_commands/module_commands.py diff --git a/api/src/opentrons/commands/protocol_commands.py b/api/src/opentrons/legacy_commands/protocol_commands.py similarity index 100% rename from api/src/opentrons/commands/protocol_commands.py rename to api/src/opentrons/legacy_commands/protocol_commands.py diff --git a/api/src/opentrons/commands/publisher.py b/api/src/opentrons/legacy_commands/publisher.py similarity index 100% rename from api/src/opentrons/commands/publisher.py rename to api/src/opentrons/legacy_commands/publisher.py diff --git a/api/src/opentrons/commands/types.py b/api/src/opentrons/legacy_commands/types.py similarity index 100% rename from api/src/opentrons/commands/types.py rename to api/src/opentrons/legacy_commands/types.py diff --git a/api/src/opentrons/protocol_api/instrument_context.py b/api/src/opentrons/protocol_api/instrument_context.py index 5af30f52203..fdcf7a0c4f4 100644 --- a/api/src/opentrons/protocol_api/instrument_context.py +++ b/api/src/opentrons/protocol_api/instrument_context.py @@ -11,9 +11,9 @@ from opentrons.legacy_broker import LegacyBroker from opentrons.hardware_control.dev_types import PipetteDict from opentrons import types -from opentrons.commands import commands as cmds +from opentrons.legacy_commands import commands as cmds -from opentrons.commands import publisher +from opentrons.legacy_commands import publisher from opentrons.protocols.advanced_control.mix import mix_from_kwargs from opentrons.protocols.advanced_control import transfers diff --git a/api/src/opentrons/protocol_api/module_contexts.py b/api/src/opentrons/protocol_api/module_contexts.py index f525fe6b320..5e9d412835e 100644 --- a/api/src/opentrons/protocol_api/module_contexts.py +++ b/api/src/opentrons/protocol_api/module_contexts.py @@ -8,8 +8,8 @@ from opentrons.legacy_broker import LegacyBroker from opentrons.hardware_control.modules import ThermocyclerStep -from opentrons.commands import module_commands as cmds -from opentrons.commands.publisher import CommandPublisher, publish +from opentrons.legacy_commands import module_commands as cmds +from opentrons.legacy_commands.publisher import CommandPublisher, publish from opentrons.protocols.api_support.types import APIVersion from opentrons.protocols.api_support.util import APIVersionError, requires_version diff --git a/api/src/opentrons/protocol_api/protocol_context.py b/api/src/opentrons/protocol_api/protocol_context.py index 2dd7815c09f..feb8f56d91c 100644 --- a/api/src/opentrons/protocol_api/protocol_context.py +++ b/api/src/opentrons/protocol_api/protocol_context.py @@ -20,9 +20,13 @@ from opentrons.legacy_broker import LegacyBroker from opentrons.hardware_control import SyncHardwareAPI from opentrons.hardware_control.modules.types import MagneticBlockModel -from opentrons.commands import protocol_commands as cmds, types as cmd_types -from opentrons.commands.helpers import stringify_labware_movement_command -from opentrons.commands.publisher import CommandPublisher, publish, publish_context +from opentrons.legacy_commands import protocol_commands as cmds, types as cmd_types +from opentrons.legacy_commands.helpers import stringify_labware_movement_command +from opentrons.legacy_commands.publisher import ( + CommandPublisher, + publish, + publish_context, +) from opentrons.protocols.api_support import instrument as instrument_support from opentrons.protocols.api_support.deck_type import ( NoTrashDefinedError, diff --git a/api/src/opentrons/protocol_engine/clients/sync_client.py b/api/src/opentrons/protocol_engine/clients/sync_client.py index 53703c16dee..f9c9e2ee6c6 100644 --- a/api/src/opentrons/protocol_engine/clients/sync_client.py +++ b/api/src/opentrons/protocol_engine/clients/sync_client.py @@ -6,7 +6,9 @@ from opentrons_shared_data.labware.dev_types import LabwareUri from opentrons_shared_data.labware.labware_definition import LabwareDefinition -from opentrons.commands.protocol_commands import comment as make_legacy_comment_command +from opentrons.legacy_commands.protocol_commands import ( + comment as make_legacy_comment_command, +) from opentrons.types import MountType from opentrons.hardware_control.modules.types import ThermocyclerStep diff --git a/api/src/opentrons/protocol_runner/legacy_command_mapper.py b/api/src/opentrons/protocol_runner/legacy_command_mapper.py index 53846baf653..ea212123cb3 100644 --- a/api/src/opentrons/protocol_runner/legacy_command_mapper.py +++ b/api/src/opentrons/protocol_runner/legacy_command_mapper.py @@ -6,7 +6,7 @@ from opentrons_shared_data.pipette.dev_types import PipetteNameType from opentrons.types import MountType, DeckSlotName, Location -from opentrons.commands import types as legacy_command_types +from opentrons.legacy_commands import types as legacy_command_types from opentrons.protocol_engine import ( ProtocolEngineError, actions as pe_actions, diff --git a/api/src/opentrons/protocol_runner/legacy_context_plugin.py b/api/src/opentrons/protocol_runner/legacy_context_plugin.py index 3e32877f232..7dd882f0fb7 100644 --- a/api/src/opentrons/protocol_runner/legacy_context_plugin.py +++ b/api/src/opentrons/protocol_runner/legacy_context_plugin.py @@ -5,7 +5,7 @@ from contextlib import ExitStack from typing import List, Optional -from opentrons.commands.types import CommandMessage as LegacyCommand +from opentrons.legacy_commands.types import CommandMessage as LegacyCommand from opentrons.legacy_broker import LegacyBroker from opentrons.protocol_engine import AbstractPlugin, actions as pe_actions from opentrons.util.broker import ReadOnlyBroker diff --git a/api/src/opentrons/protocols/duration/estimator.py b/api/src/opentrons/protocols/duration/estimator.py index 6f481c29772..5e3b6ef2663 100644 --- a/api/src/opentrons/protocols/duration/estimator.py +++ b/api/src/opentrons/protocols/duration/estimator.py @@ -7,7 +7,7 @@ from dataclasses import dataclass -from opentrons.commands import types +from opentrons.legacy_commands import types from opentrons.protocols.api_support.deck_type import ( guess_from_global_config as guess_deck_type_from_global_config, ) diff --git a/api/src/opentrons/simulate.py b/api/src/opentrons/simulate.py index c5f48c9d1bd..f552a99571f 100644 --- a/api/src/opentrons/simulate.py +++ b/api/src/opentrons/simulate.py @@ -54,7 +54,7 @@ from opentrons.legacy_broker import LegacyBroker from opentrons.config import IS_ROBOT from opentrons import protocol_api -from opentrons.commands import types as command_types +from opentrons.legacy_commands import types as command_types from opentrons.protocols import parse, bundle from opentrons.protocols.types import ( @@ -114,7 +114,7 @@ # TODO(mm, 2023-10-05): Type _SimulateResultRunLog more precisely by using TypedDicts from -# opentrons.commands. +# opentrons.legacy_commands. _SimulateResultRunLog = List[Mapping[str, Any]] _SimulateResult = Tuple[_SimulateResultRunLog, Optional[BundleContents]] @@ -453,7 +453,7 @@ def simulate( - ``payload``: The command. The human-readable run log text is available at ``payload["text"]``. The other keys of ``payload`` are command-dependent; - see ``opentrons.commands``. + see ``opentrons.legacy_commands``. .. note:: In older software versions, ``payload["text"]`` was a diff --git a/api/tests/opentrons/commands/__init__.py b/api/tests/opentrons/commands/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/api/src/opentrons/commands/__init__.py b/api/tests/opentrons/legacy_commands/__init__.py similarity index 100% rename from api/src/opentrons/commands/__init__.py rename to api/tests/opentrons/legacy_commands/__init__.py diff --git a/api/tests/opentrons/commands/test_protocol_commands.py b/api/tests/opentrons/legacy_commands/test_protocol_commands.py similarity index 96% rename from api/tests/opentrons/commands/test_protocol_commands.py rename to api/tests/opentrons/legacy_commands/test_protocol_commands.py index e7fb31aed1c..1ff5475f95b 100644 --- a/api/tests/opentrons/commands/test_protocol_commands.py +++ b/api/tests/opentrons/legacy_commands/test_protocol_commands.py @@ -1,5 +1,5 @@ import pytest -from opentrons.commands import protocol_commands +from opentrons.legacy_commands import protocol_commands @pytest.mark.parametrize( diff --git a/api/tests/opentrons/commands/test_publisher.py b/api/tests/opentrons/legacy_commands/test_publisher.py similarity index 97% rename from api/tests/opentrons/commands/test_publisher.py rename to api/tests/opentrons/legacy_commands/test_publisher.py index a88e6c04523..359b6b3c5fd 100644 --- a/api/tests/opentrons/commands/test_publisher.py +++ b/api/tests/opentrons/legacy_commands/test_publisher.py @@ -1,12 +1,16 @@ -"""Tests for opentrons.commands.publisher.""" +"""Tests for opentrons.legacy_commands.publisher.""" from __future__ import annotations import pytest from decoy import Decoy, matchers from typing import Any, Dict, cast from opentrons.legacy_broker import LegacyBroker -from opentrons.commands.types import Command as CommandDict, CommandMessage -from opentrons.commands.publisher import CommandPublisher, publish, publish_context +from opentrons.legacy_commands.types import Command as CommandDict, CommandMessage +from opentrons.legacy_commands.publisher import ( + CommandPublisher, + publish, + publish_context, +) @pytest.fixture diff --git a/api/tests/opentrons/protocol_runner/test_legacy_command_mapper.py b/api/tests/opentrons/protocol_runner/test_legacy_command_mapper.py index 8a8ec50b779..23b7ecac3bb 100644 --- a/api/tests/opentrons/protocol_runner/test_legacy_command_mapper.py +++ b/api/tests/opentrons/protocol_runner/test_legacy_command_mapper.py @@ -7,7 +7,7 @@ from decoy import matchers, Decoy from opentrons.hardware_control.dev_types import PipetteDict -from opentrons.commands.types import CommentMessage, PauseMessage, CommandMessage +from opentrons.legacy_commands.types import CommentMessage, PauseMessage, CommandMessage from opentrons.protocol_engine import ( DeckSlotLocation, ModuleLocation, diff --git a/api/tests/opentrons/protocol_runner/test_legacy_context_plugin.py b/api/tests/opentrons/protocol_runner/test_legacy_context_plugin.py index 1f7de8388ca..f11676bcd37 100644 --- a/api/tests/opentrons/protocol_runner/test_legacy_context_plugin.py +++ b/api/tests/opentrons/protocol_runner/test_legacy_context_plugin.py @@ -5,7 +5,10 @@ from datetime import datetime from typing import Callable -from opentrons.commands.types import CommandMessage as LegacyCommand, PauseMessage +from opentrons.legacy_commands.types import ( + CommandMessage as LegacyCommand, + PauseMessage, +) from opentrons.protocol_engine import ( StateView, actions as pe_actions, diff --git a/api/tests/opentrons/protocols/duration/test_estimator.py b/api/tests/opentrons/protocols/duration/test_estimator.py index 92614869641..594f1cfad57 100644 --- a/api/tests/opentrons/protocols/duration/test_estimator.py +++ b/api/tests/opentrons/protocols/duration/test_estimator.py @@ -3,7 +3,7 @@ import math import pytest -from opentrons.commands import types +from opentrons.legacy_commands import types from opentrons.protocol_api import InstrumentContext from opentrons.protocols.duration.estimator import ( DurationEstimator, diff --git a/api/tests/opentrons/test_legacy_broker.py b/api/tests/opentrons/test_legacy_broker.py index 2351f73e348..719fe43052d 100644 --- a/api/tests/opentrons/test_legacy_broker.py +++ b/api/tests/opentrons/test_legacy_broker.py @@ -2,8 +2,8 @@ from typing import List, NamedTuple, cast -from opentrons.commands.types import CommandMessage -from opentrons.commands.publisher import CommandPublisher, publish +from opentrons.legacy_commands.types import CommandMessage +from opentrons.legacy_commands.publisher import CommandPublisher, publish def _my_command(arg1: int, arg2: str = "", arg3: str = "") -> CommandMessage: