diff --git a/api/opentrons/__init__.py b/api/opentrons/__init__.py index c7fb0b8ceb8..a7c19d54d58 100755 --- a/api/opentrons/__init__.py +++ b/api/opentrons/__init__.py @@ -1,9 +1,6 @@ import os import sys import json -from opentrons.robot.robot import Robot -from opentrons.instruments import pipette_config -from opentrons import instruments as inst, containers as cnt from opentrons.data_storage import database_migration from opentrons.config import feature_flags as ff @@ -24,262 +21,19 @@ if not ff.split_labware_definitions(): database_migration.check_version_and_perform_necessary_migrations() -robot = Robot() +if ff.use_protocol_api_v2(): + import protocol_api + from protocol_api.back_compat\ + import robot, reset as bcreset, instruments, containers, labware -def reset(): - global robot - robot = Robot() - return robot + def reset(): + ctx = protocol_api.ProtocolContext() + bcreset(ctx) +else: + from .legacy_api.api import robot, reset, instruments, containers, labware -class ContainersWrapper(object): - def __init__(self, robot): - self.robot = robot - def create(self, *args, **kwargs): - return cnt.create(*args, **kwargs) - - def list(self, *args, **kwargs): - return cnt.list(*args, **kwargs) - - def load(self, *args, **kwargs): - return cnt.load(self.robot, *args, **kwargs) - - -class InstrumentsWrapper(object): - def __init__(self, robot): - self.robot = robot - - def Pipette(self, *args, **kwargs): - """ - Deprecated -- do not use this constructor directly. Use the model- - specific constructors available in this module. - """ - return inst.Pipette(self.robot, *args, **kwargs) - - def P10_Single( - self, - mount, - trash_container='', - tip_racks=[], - aspirate_flow_rate=None, - dispense_flow_rate=None, - min_volume=None, - max_volume=None): - - pipette_model_version = self._retrieve_version_number( - mount, 'p10_single') - config = pipette_config.load(pipette_model_version) - - return self._create_pipette_from_config( - config=config, - mount=mount, - trash_container=trash_container, - tip_racks=tip_racks, - aspirate_flow_rate=aspirate_flow_rate, - dispense_flow_rate=dispense_flow_rate, - min_volume=min_volume, - max_volume=max_volume) - - def P10_Multi( - self, - mount, - trash_container='', - tip_racks=[], - aspirate_flow_rate=None, - dispense_flow_rate=None, - min_volume=None, - max_volume=None): - - pipette_model_version = self._retrieve_version_number( - mount, 'p10_multi') - config = pipette_config.load(pipette_model_version) - - return self._create_pipette_from_config( - config=config, - mount=mount, - trash_container=trash_container, - tip_racks=tip_racks, - aspirate_flow_rate=aspirate_flow_rate, - dispense_flow_rate=dispense_flow_rate, - min_volume=min_volume, - max_volume=max_volume) - - def P50_Single( - self, - mount, - trash_container='', - tip_racks=[], - aspirate_flow_rate=None, - dispense_flow_rate=None, - min_volume=None, - max_volume=None): - - pipette_model_version = self._retrieve_version_number( - mount, 'p50_single') - config = pipette_config.load(pipette_model_version) - - return self._create_pipette_from_config( - config=config, - mount=mount, - trash_container=trash_container, - tip_racks=tip_racks, - aspirate_flow_rate=aspirate_flow_rate, - dispense_flow_rate=dispense_flow_rate, - min_volume=min_volume, - max_volume=max_volume) - - def P50_Multi( - self, - mount, - trash_container='', - tip_racks=[], - aspirate_flow_rate=None, - dispense_flow_rate=None, - min_volume=None, - max_volume=None): - - pipette_model_version = self._retrieve_version_number( - mount, 'p50_multi') - config = pipette_config.load(pipette_model_version) - - return self._create_pipette_from_config( - config=config, - mount=mount, - trash_container=trash_container, - tip_racks=tip_racks, - aspirate_flow_rate=aspirate_flow_rate, - dispense_flow_rate=dispense_flow_rate, - min_volume=min_volume, - max_volume=max_volume) - - def P300_Single( - self, - mount, - trash_container='', - tip_racks=[], - aspirate_flow_rate=None, - dispense_flow_rate=None, - min_volume=None, - max_volume=None): - - pipette_model_version = self._retrieve_version_number( - mount, 'p300_single') - config = pipette_config.load(pipette_model_version) - - return self._create_pipette_from_config( - config=config, - mount=mount, - trash_container=trash_container, - tip_racks=tip_racks, - aspirate_flow_rate=aspirate_flow_rate, - dispense_flow_rate=dispense_flow_rate, - min_volume=min_volume, - max_volume=max_volume) - - def P300_Multi( - self, - mount, - trash_container='', - tip_racks=[], - aspirate_flow_rate=None, - dispense_flow_rate=None, - min_volume=None, - max_volume=None): - - pipette_model_version = self._retrieve_version_number( - mount, 'p300_multi') - config = pipette_config.load(pipette_model_version) - - return self._create_pipette_from_config( - config=config, - mount=mount, - trash_container=trash_container, - tip_racks=tip_racks, - aspirate_flow_rate=aspirate_flow_rate, - dispense_flow_rate=dispense_flow_rate, - min_volume=min_volume, - max_volume=max_volume) - - def P1000_Single( - self, - mount, - trash_container='', - tip_racks=[], - aspirate_flow_rate=None, - dispense_flow_rate=None, - min_volume=None, - max_volume=None): - - pipette_model_version = self._retrieve_version_number( - mount, 'p1000_single') - config = pipette_config.load(pipette_model_version) - - return self._create_pipette_from_config( - config=config, - mount=mount, - trash_container=trash_container, - tip_racks=tip_racks, - aspirate_flow_rate=aspirate_flow_rate, - dispense_flow_rate=dispense_flow_rate, - min_volume=min_volume, - max_volume=max_volume) - - def _create_pipette_from_config( - self, - config, - mount, - trash_container='', - tip_racks=[], - aspirate_flow_rate=None, - dispense_flow_rate=None, - min_volume=None, - max_volume=None): - - if aspirate_flow_rate is not None: - config = config._replace(aspirate_flow_rate=aspirate_flow_rate) - if dispense_flow_rate is not None: - config = config._replace(dispense_flow_rate=dispense_flow_rate) - - if min_volume is not None: - config = config._replace(min_volume=min_volume) - if max_volume is not None: - config = config._replace(max_volume=max_volume) - - p = self.Pipette( - model_offset=config.model_offset, - mount=mount, - name=config.name, - trash_container=trash_container, - tip_racks=tip_racks, - channels=config.channels, - aspirate_flow_rate=config.aspirate_flow_rate, - dispense_flow_rate=config.dispense_flow_rate, - min_volume=config.min_volume, - max_volume=config.max_volume, - plunger_current=config.plunger_current, - drop_tip_current=config.drop_tip_current, - plunger_positions=config.plunger_positions.copy(), - fallback_tip_length=config.tip_length) # TODO move to labware - - p.set_pick_up_current(config.pick_up_current) - return p - - def _retrieve_version_number(self, mount, expected_model_substring): - attached_model = robot.get_attached_pipettes()[mount]['model'] - - if attached_model and expected_model_substring in attached_model: - return attached_model - else: - # pass a default pipette model-version for when robot is simulating - # this allows any pipette to be simulated, regardless of what is - # actually attached/cached on the robot's mounts - return expected_model_substring + '_v1' # default to v1 - - -instruments = InstrumentsWrapper(robot) -containers = ContainersWrapper(robot) -labware = ContainersWrapper(robot) - -__all__ = [containers, instruments, labware, robot, reset, __version__] +__all__ = ['containers', 'instruments', 'labware', 'robot', 'reset', + '__version__'] diff --git a/api/opentrons/api/__init__.py b/api/opentrons/api/__init__.py index 4ddcf919074..53c6ec8b8b4 100644 --- a/api/opentrons/api/__init__.py +++ b/api/opentrons/api/__init__.py @@ -3,8 +3,8 @@ from .calibration import CalibrationManager __all__ = [ - Session, - SessionManager, - MainRouter, - CalibrationManager + 'Session', + 'SessionManager', + 'MainRouter', + 'CalibrationManager' ] diff --git a/api/opentrons/api/models.py b/api/opentrons/api/models.py index 15e3c3accb6..8bf9da5c82f 100755 --- a/api/opentrons/api/models.py +++ b/api/opentrons/api/models.py @@ -1,4 +1,4 @@ -from opentrons.containers import Slot +from opentrons.legacy_api.containers import Slot def _get_parent_slot(placeable): diff --git a/api/opentrons/api/session.py b/api/opentrons/api/session.py index 4b2567e82d2..bb1d6b23a9d 100755 --- a/api/opentrons/api/session.py +++ b/api/opentrons/api/session.py @@ -6,8 +6,8 @@ import json from opentrons.broker import publish, subscribe -from opentrons.containers import get_container, location_to_list -from opentrons.containers.placeable import Module as ModulePlaceable +from opentrons.legacy_api.containers import get_container, location_to_list +from opentrons.legacy_api.containers.placeable import Module as ModulePlaceable from opentrons.commands import tree, types from opentrons.protocols import execute_protocol from opentrons import robot, modules diff --git a/api/opentrons/commands/commands.py b/api/opentrons/commands/commands.py index 6c167177186..f2e8c6c80d3 100755 --- a/api/opentrons/commands/commands.py +++ b/api/opentrons/commands/commands.py @@ -2,7 +2,8 @@ from ..broker import broker import functools import inspect -from opentrons.containers import Well, Container, Slot, location_to_list +from opentrons.legacy_api.containers\ + import Well, Container, Slot, location_to_list def stringify_location(location): diff --git a/api/opentrons/config/advanced_settings.py b/api/opentrons/config/advanced_settings.py index 37b810bc12c..b50fbdfb33f 100644 --- a/api/opentrons/config/advanced_settings.py +++ b/api/opentrons/config/advanced_settings.py @@ -50,6 +50,11 @@ def __repr__(self): old_id='disable-home-on-boot', title='Disable home on boot', description='Prevent robot from homing motors on boot' + ), + Setting( + _id='useProtocolApi2', + title='Use Protocol API version 2', + description='Use new implementation of protocol API. This should not be activated except by developers.' # noqa ) ] diff --git a/api/opentrons/config/feature_flags.py b/api/opentrons/config/feature_flags.py index 95dc2e766cb..11309363e86 100644 --- a/api/opentrons/config/feature_flags.py +++ b/api/opentrons/config/feature_flags.py @@ -21,3 +21,7 @@ def dots_deck_type(): def disable_home_on_boot(): return advs.get_adv_setting('disableHomeOnBoot') + + +def use_protocol_api_v2(): + return advs.get_adv_setting('useProtocolApi2') diff --git a/api/opentrons/data_storage/database.py b/api/opentrons/data_storage/database.py index b3caec5b19d..45c3ba01da3 100644 --- a/api/opentrons/data_storage/database.py +++ b/api/opentrons/data_storage/database.py @@ -2,7 +2,8 @@ import sqlite3 # import warnings from typing import List -from opentrons.containers.placeable import Container, Well, Module +from opentrons.legacy_api.containers.placeable\ + import Container, Well, Module from opentrons.data_storage import database_queries as db_queries from opentrons.util import environment from opentrons.util.vector import Vector diff --git a/api/opentrons/data_storage/old_container_loading.py b/api/opentrons/data_storage/old_container_loading.py index f9e9017a50c..9829496cbc7 100755 --- a/api/opentrons/data_storage/old_container_loading.py +++ b/api/opentrons/data_storage/old_container_loading.py @@ -11,7 +11,7 @@ import os import pkg_resources from collections import OrderedDict -from opentrons.containers.placeable import Container, Well +from opentrons.legacy_api.containers.placeable import Container, Well from opentrons.util import environment from opentrons.util.vector import Vector diff --git a/api/opentrons/data_storage/serializers.py b/api/opentrons/data_storage/serializers.py index 1a583d59d92..f8415b4f8ee 100755 --- a/api/opentrons/data_storage/serializers.py +++ b/api/opentrons/data_storage/serializers.py @@ -1,5 +1,5 @@ # pylama:ignore=E252 -from opentrons.containers.placeable import Well, Container +from opentrons.legacy_api.containers.placeable import Well, Container from opentrons.util.vector import Vector from numbers import Number from typing import Tuple diff --git a/api/opentrons/deck_calibration/__init__.py b/api/opentrons/deck_calibration/__init__.py index 964b4828eee..750466d5fe7 100644 --- a/api/opentrons/deck_calibration/__init__.py +++ b/api/opentrons/deck_calibration/__init__.py @@ -1,5 +1,4 @@ from opentrons import robot -from opentrons.robot.robot import Robot from opentrons.config import feature_flags as ff # Application constants @@ -80,7 +79,7 @@ def jog(axis, direction, step): return position(axis) -def set_calibration_value(rbt: Robot, axis: str, value: float): +def set_calibration_value(rbt, axis: str, value: float): if axis == 'x': row = x_row elif axis == 'y': diff --git a/api/opentrons/deck_calibration/dc_main.py b/api/opentrons/deck_calibration/dc_main.py index 24f7c84a482..b92f41c8e44 100644 --- a/api/opentrons/deck_calibration/dc_main.py +++ b/api/opentrons/deck_calibration/dc_main.py @@ -11,7 +11,7 @@ from typing import Tuple from numpy.linalg import inv from numpy import dot, array -from opentrons.robot import robot_configs +from opentrons.legacy_api.robot import robot_configs from opentrons import robot, instruments from opentrons.util.calibration_functions import probe_instrument from opentrons.deck_calibration.linal import solve, add_z, apply_transform diff --git a/api/opentrons/deck_calibration/endpoints.py b/api/opentrons/deck_calibration/endpoints.py index e27b4149750..b39ba5c3d31 100644 --- a/api/opentrons/deck_calibration/endpoints.py +++ b/api/opentrons/deck_calibration/endpoints.py @@ -1,8 +1,8 @@ from aiohttp import web from uuid import uuid1 -from opentrons.instruments import pipette_config +from opentrons.legacy_api.instruments import pipette_config from opentrons import instruments, robot -from opentrons.robot import robot_configs +from opentrons.legacy_api.robot import robot_configs from opentrons.deck_calibration import jog, position, dots_set, z_pos from opentrons.deck_calibration.linal import add_z, solve from typing import Dict, Tuple diff --git a/api/opentrons/legacy_api/__init__.py b/api/opentrons/legacy_api/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/api/opentrons/legacy_api/api.py b/api/opentrons/legacy_api/api.py new file mode 100644 index 00000000000..ba2fccad74c --- /dev/null +++ b/api/opentrons/legacy_api/api.py @@ -0,0 +1,262 @@ +from . import robot, instruments as inst, containers as cnt +from .instruments import pipette_config + +robot = robot.Robot() # typing: ignore This is why we’re moving away from it + + +def reset(): + global robot + robot = robot.Robot() + return robot + + +class ContainersWrapper(object): + def __init__(self, robot): + self.robot = robot + + def create(self, *args, **kwargs): + return cnt.create(*args, **kwargs) + + def list(self, *args, **kwargs): + return cnt.list(*args, **kwargs) + + def load(self, *args, **kwargs): + return cnt.load(self.robot, *args, **kwargs) + + +class InstrumentsWrapper(object): + def __init__(self, robot): + self.robot = robot + + def Pipette(self, *args, **kwargs): + """ + Deprecated -- do not use this constructor directly. Use the model- + specific constructors available in this module. + """ + return inst.Pipette(self.robot, *args, **kwargs) + + def P10_Single( + self, + mount, + trash_container='', + tip_racks=[], + aspirate_flow_rate=None, + dispense_flow_rate=None, + min_volume=None, + max_volume=None): + + pipette_model_version = self._retrieve_version_number( + mount, 'p10_single') + config = pipette_config.load(pipette_model_version) + + return self._create_pipette_from_config( + config=config, + mount=mount, + trash_container=trash_container, + tip_racks=tip_racks, + aspirate_flow_rate=aspirate_flow_rate, + dispense_flow_rate=dispense_flow_rate, + min_volume=min_volume, + max_volume=max_volume) + + def P10_Multi( + self, + mount, + trash_container='', + tip_racks=[], + aspirate_flow_rate=None, + dispense_flow_rate=None, + min_volume=None, + max_volume=None): + + pipette_model_version = self._retrieve_version_number( + mount, 'p10_multi') + config = pipette_config.load(pipette_model_version) + + return self._create_pipette_from_config( + config=config, + mount=mount, + trash_container=trash_container, + tip_racks=tip_racks, + aspirate_flow_rate=aspirate_flow_rate, + dispense_flow_rate=dispense_flow_rate, + min_volume=min_volume, + max_volume=max_volume) + + def P50_Single( + self, + mount, + trash_container='', + tip_racks=[], + aspirate_flow_rate=None, + dispense_flow_rate=None, + min_volume=None, + max_volume=None): + + pipette_model_version = self._retrieve_version_number( + mount, 'p50_single') + config = pipette_config.load(pipette_model_version) + + return self._create_pipette_from_config( + config=config, + mount=mount, + trash_container=trash_container, + tip_racks=tip_racks, + aspirate_flow_rate=aspirate_flow_rate, + dispense_flow_rate=dispense_flow_rate, + min_volume=min_volume, + max_volume=max_volume) + + def P50_Multi( + self, + mount, + trash_container='', + tip_racks=[], + aspirate_flow_rate=None, + dispense_flow_rate=None, + min_volume=None, + max_volume=None): + + pipette_model_version = self._retrieve_version_number( + mount, 'p50_multi') + config = pipette_config.load(pipette_model_version) + + return self._create_pipette_from_config( + config=config, + mount=mount, + trash_container=trash_container, + tip_racks=tip_racks, + aspirate_flow_rate=aspirate_flow_rate, + dispense_flow_rate=dispense_flow_rate, + min_volume=min_volume, + max_volume=max_volume) + + def P300_Single( + self, + mount, + trash_container='', + tip_racks=[], + aspirate_flow_rate=None, + dispense_flow_rate=None, + min_volume=None, + max_volume=None): + + pipette_model_version = self._retrieve_version_number( + mount, 'p300_single') + config = pipette_config.load(pipette_model_version) + + return self._create_pipette_from_config( + config=config, + mount=mount, + trash_container=trash_container, + tip_racks=tip_racks, + aspirate_flow_rate=aspirate_flow_rate, + dispense_flow_rate=dispense_flow_rate, + min_volume=min_volume, + max_volume=max_volume) + + def P300_Multi( + self, + mount, + trash_container='', + tip_racks=[], + aspirate_flow_rate=None, + dispense_flow_rate=None, + min_volume=None, + max_volume=None): + + pipette_model_version = self._retrieve_version_number( + mount, 'p300_multi') + config = pipette_config.load(pipette_model_version) + + return self._create_pipette_from_config( + config=config, + mount=mount, + trash_container=trash_container, + tip_racks=tip_racks, + aspirate_flow_rate=aspirate_flow_rate, + dispense_flow_rate=dispense_flow_rate, + min_volume=min_volume, + max_volume=max_volume) + + def P1000_Single( + self, + mount, + trash_container='', + tip_racks=[], + aspirate_flow_rate=None, + dispense_flow_rate=None, + min_volume=None, + max_volume=None): + + pipette_model_version = self._retrieve_version_number( + mount, 'p1000_single') + config = pipette_config.load(pipette_model_version) + + return self._create_pipette_from_config( + config=config, + mount=mount, + trash_container=trash_container, + tip_racks=tip_racks, + aspirate_flow_rate=aspirate_flow_rate, + dispense_flow_rate=dispense_flow_rate, + min_volume=min_volume, + max_volume=max_volume) + + def _create_pipette_from_config( + self, + config, + mount, + trash_container='', + tip_racks=[], + aspirate_flow_rate=None, + dispense_flow_rate=None, + min_volume=None, + max_volume=None): + + if aspirate_flow_rate is not None: + config = config._replace(aspirate_flow_rate=aspirate_flow_rate) + if dispense_flow_rate is not None: + config = config._replace(dispense_flow_rate=dispense_flow_rate) + + if min_volume is not None: + config = config._replace(min_volume=min_volume) + if max_volume is not None: + config = config._replace(max_volume=max_volume) + + p = self.Pipette( + model_offset=config.model_offset, + mount=mount, + name=config.name, + trash_container=trash_container, + tip_racks=tip_racks, + channels=config.channels, + aspirate_flow_rate=config.aspirate_flow_rate, + dispense_flow_rate=config.dispense_flow_rate, + min_volume=config.min_volume, + max_volume=config.max_volume, + plunger_current=config.plunger_current, + drop_tip_current=config.drop_tip_current, + plunger_positions=config.plunger_positions.copy(), + fallback_tip_length=config.tip_length) # TODO move to labware + + p.set_pick_up_current(config.pick_up_current) + return p + + def _retrieve_version_number(self, mount, expected_model_substring): + attached_model = robot.get_attached_pipettes()[mount]['model'] + + if attached_model and expected_model_substring in attached_model: + return attached_model + else: + # pass a default pipette model-version for when robot is simulating + # this allows any pipette to be simulated, regardless of what is + # actually attached/cached on the robot's mounts + return expected_model_substring + '_v1' # default to v1 + + +instruments = InstrumentsWrapper(robot) +containers = ContainersWrapper(robot) +labware = ContainersWrapper(robot) + +__all__ = ['containers', 'instruments', 'labware', 'robot', 'reset'] diff --git a/api/opentrons/containers/__init__.py b/api/opentrons/legacy_api/containers/__init__.py similarity index 96% rename from api/opentrons/containers/__init__.py rename to api/opentrons/legacy_api/containers/__init__.py index fe2547da902..a12e063e200 100644 --- a/api/opentrons/containers/__init__.py +++ b/api/opentrons/legacy_api/containers/__init__.py @@ -4,7 +4,7 @@ import warnings from opentrons.data_storage import database -from opentrons.containers.placeable import ( +from .placeable import ( Deck, Slot, Container, @@ -18,14 +18,14 @@ from opentrons.util import environment __all__ = [ - Deck, - Slot, - Container, - Well, - WellSeries, - unpack_location, - location_to_list, - get_container] + 'Deck', + 'Slot', + 'Container', + 'Well', + 'WellSeries', + 'unpack_location', + 'location_to_list', + 'get_container'] def load(robot, container_name, slot, label=None, share=False): diff --git a/api/opentrons/containers/placeable.py b/api/opentrons/legacy_api/containers/placeable.py similarity index 100% rename from api/opentrons/containers/placeable.py rename to api/opentrons/legacy_api/containers/placeable.py diff --git a/api/opentrons/instruments/__init__.py b/api/opentrons/legacy_api/instruments/__init__.py similarity index 65% rename from api/opentrons/instruments/__init__.py rename to api/opentrons/legacy_api/instruments/__init__.py index 0b400633f69..355e8c91921 100644 --- a/api/opentrons/instruments/__init__.py +++ b/api/opentrons/legacy_api/instruments/__init__.py @@ -1,8 +1,8 @@ -from opentrons.instruments.pipette import Pipette +from .pipette import Pipette __all__ = [ - Pipette + 'Pipette' ] diff --git a/api/opentrons/instruments/instrument.py b/api/opentrons/legacy_api/instruments/instrument.py similarity index 100% rename from api/opentrons/instruments/instrument.py rename to api/opentrons/legacy_api/instruments/instrument.py diff --git a/api/opentrons/instruments/pipette.py b/api/opentrons/legacy_api/instruments/pipette.py similarity index 99% rename from api/opentrons/instruments/pipette.py rename to api/opentrons/legacy_api/instruments/pipette.py index 9d7fb79a7b7..f0fc84be3d2 100755 --- a/api/opentrons/instruments/pipette.py +++ b/api/opentrons/legacy_api/instruments/pipette.py @@ -6,8 +6,8 @@ import time from opentrons import commands -from opentrons.containers import unpack_location -from opentrons.containers.placeable import ( +from ..containers import unpack_location +from ..containers.placeable import ( Container, Placeable, WellSeries ) from opentrons.helpers import helpers diff --git a/api/opentrons/instruments/pipette_config.py b/api/opentrons/legacy_api/instruments/pipette_config.py similarity index 100% rename from api/opentrons/instruments/pipette_config.py rename to api/opentrons/legacy_api/instruments/pipette_config.py diff --git a/api/opentrons/legacy_api/robot/__init__.py b/api/opentrons/legacy_api/robot/__init__.py new file mode 100644 index 00000000000..e42358f96a2 --- /dev/null +++ b/api/opentrons/legacy_api/robot/__init__.py @@ -0,0 +1,3 @@ +from .robot import Robot + +__all__ = ['Robot'] diff --git a/api/opentrons/robot/mover.py b/api/opentrons/legacy_api/robot/mover.py similarity index 98% rename from api/opentrons/robot/mover.py rename to api/opentrons/legacy_api/robot/mover.py index 2599b907f36..a887b704bee 100755 --- a/api/opentrons/robot/mover.py +++ b/api/opentrons/legacy_api/robot/mover.py @@ -1,4 +1,4 @@ -from ..trackers.pose_tracker import Point, change_base, update, ROOT +from opentrons.trackers.pose_tracker import Point, change_base, update, ROOT class Mover: diff --git a/api/opentrons/robot/robot.py b/api/opentrons/legacy_api/robot/robot.py similarity index 99% rename from api/opentrons/robot/robot.py rename to api/opentrons/legacy_api/robot/robot.py index 42ec8ebc178..0924f6ae457 100755 --- a/api/opentrons/robot/robot.py +++ b/api/opentrons/legacy_api/robot/robot.py @@ -4,18 +4,22 @@ import opentrons.util.calibration_functions as calib from numpy import add, subtract -from opentrons import commands, containers, drivers -from opentrons.instruments import pipette_config + +from opentrons import commands, drivers from opentrons.broker import subscribe -from opentrons.containers import Container + from opentrons.data_storage import database, old_container_loading,\ database_migration from opentrons.drivers.smoothie_drivers import driver_3_0 -from opentrons.robot.mover import Mover -from opentrons.robot.robot_configs import load from opentrons.trackers import pose_tracker from opentrons.config import feature_flags as fflags +from opentrons.legacy_api import containers +from opentrons.legacy_api.robot.mover import Mover +from opentrons.legacy_api.robot.robot_configs import load +from opentrons.legacy_api.containers import Container +from opentrons.legacy_api.instruments import pipette_config + log = logging.getLogger(__name__) TIP_CLEARANCE_DECK = 20 # clearance when moving between different labware diff --git a/api/opentrons/robot/robot_configs.py b/api/opentrons/legacy_api/robot/robot_configs.py similarity index 100% rename from api/opentrons/robot/robot_configs.py rename to api/opentrons/legacy_api/robot/robot_configs.py diff --git a/api/opentrons/protocol_api/__init__.py b/api/opentrons/protocol_api/__init__.py index 4a7744f2271..412c274d248 100644 --- a/api/opentrons/protocol_api/__init__.py +++ b/api/opentrons/protocol_api/__init__.py @@ -2,25 +2,25 @@ This package defines classes and functions for access through a protocol to control the OT2. -""" +""" import enum import os -from typing import Callable, List, Dict +from typing import List, Dict from opentrons.protocol_api.labware import Well, Labware, load +from . import back_compat -def run(protocol_callable: Callable[['ProtocolContext'], None] = None, +def run(protocol_bytes: bytes = None, protocol_json: str = None, simulate: bool = False, context: 'ProtocolContext' = None): """ Create a ProtocolRunner instance from one of a variety of protocol sources. - :param protocol_callable: If the protocol can be represented as a - Python callable, pass it here. The callable should take a context - as its only argument. + :param protocol_bytes: If the protocol is a Python protocol, pass the + file contents here. :param protocol_json: If the protocol is a json file, pass the contents here. :param simulate: True to simulate; False to execute. If thsi is not an @@ -30,10 +30,15 @@ def run(protocol_callable: Callable[['ProtocolContext'], None] = None, """ if not os.environ.get('RUNNING_ON_PI'): simulate = True # noqa - will be used later - if None is context: - context = ProtocolContext() - if protocol_callable: - pass + if None is context and simulate: + true_context = ProtocolContext() + elif context: + true_context = context + else: + raise RuntimeError( + 'Will not automatically generate hardware controller') + if protocol_bytes: + back_compat.run(protocol_bytes, true_context) elif protocol_json: pass @@ -50,7 +55,8 @@ def __init__(self): pass def load_labware( - self, labware_obj: Labware, location: str): + self, labware_obj: Labware, location: str, + label: str = None, share: bool = False): """ Specify the presence of a piece of labware on the OT2 deck. This function loads the labware specified by ``labware`` diff --git a/api/opentrons/protocol_api/back_compat.py b/api/opentrons/protocol_api/back_compat.py new file mode 100644 index 00000000000..23349aaaa05 --- /dev/null +++ b/api/opentrons/protocol_api/back_compat.py @@ -0,0 +1,63 @@ +""" A backwards-compatibility shim for the new protocol API + +""" + +import importlib.util + +from typing import TYPE_CHECKING + +import opentrons + +if TYPE_CHECKING: + import opentrons.protocol_api as papi # noqa(F401) - used in func sigs + + +def run(protocol_bytes: bytes, context: 'papi.ProtocolContext'): + reset(context) + source = importlib.util.decode_source(protocol_bytes) + exec(source) + + +class BCRobot: + def __init__(self, protocol_ctx: 'papi.ProtocolContext') -> None: + self._ctx = protocol_ctx + + +class BCInstruments: + def __init__(self, ctx: 'papi.ProtocolContext') -> None: + pass + + +class BCLabware: + def __init__(self, ctx: 'papi.ProtocolContext') -> None: + self._ctx = ctx + + def load(self, *args, **kwargs): + return self._ctx.load_labware_by_name(*args, **kwargs) + + def create(self, *args, **kwargs): + pass + + def list(self, *args, **kwargs): + pass + + +def reset(api: 'papi.ProtocolContext'): + global robot + global labware + global containers + global instruments + robot = BCRobot(api) + labware = BCLabware(api) + containers = labware + instruments = BCInstruments(api) + return robot + + +__version__ = opentrons.__version__ +robot = None +labware = None +containers = None +instruments = None + +__all__ = ['containers', 'instruments', 'labware', 'robot', 'reset'] diff --git a/api/opentrons/protocols/__init__.py b/api/opentrons/protocols/__init__.py index c44be7a2a0d..028a4392540 100644 --- a/api/opentrons/protocols/__init__.py +++ b/api/opentrons/protocols/__init__.py @@ -1,7 +1,7 @@ import time from itertools import chain from opentrons import instruments, labware, robot -from opentrons.instruments import pipette_config +from opentrons.legacy_api.instruments import pipette_config def _sleep(seconds): diff --git a/api/opentrons/robot/__init__.py b/api/opentrons/robot/__init__.py deleted file mode 100644 index 7c0be161aa7..00000000000 --- a/api/opentrons/robot/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -from opentrons.robot.robot import Robot - -__all__ = [Robot] diff --git a/api/opentrons/server/endpoints/control.py b/api/opentrons/server/endpoints/control.py index 67ee596f29e..549be7ca141 100644 --- a/api/opentrons/server/endpoints/control.py +++ b/api/opentrons/server/endpoints/control.py @@ -5,7 +5,7 @@ from aiohttp import web from threading import Thread from opentrons import robot, instruments, modules -from opentrons.instruments import pipette_config +from opentrons.legacy_api.instruments import pipette_config from opentrons.trackers import pose_tracker log = logging.getLogger(__name__) diff --git a/api/opentrons/server/endpoints/settings.py b/api/opentrons/server/endpoints/settings.py index 5828bc4b98c..00bb0efd8f8 100644 --- a/api/opentrons/server/endpoints/settings.py +++ b/api/opentrons/server/endpoints/settings.py @@ -3,7 +3,7 @@ import os from aiohttp import web from opentrons.config import advanced_settings as advs -from opentrons.robot import robot_configs as rc +from opentrons.legacy_api.robot import robot_configs as rc from opentrons.data_storage import database as db log = logging.getLogger(__name__) diff --git a/api/opentrons/simulate_protocol.py b/api/opentrons/simulate_protocol.py new file mode 100644 index 00000000000..63072669985 --- /dev/null +++ b/api/opentrons/simulate_protocol.py @@ -0,0 +1,14 @@ +""" Run a protocol locally to test it before sending it to an OT2 +""" +import argparse +import opentrons.protocol_api as protocol_api + + +if __name__ == '__main__': + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument('protocol', metavar='PROTOCOL', + type=argparse.FileType('rb'), + help='The python protocol file to run') + args = parser.parse_args() + protocol_api.run(protocol_bytes=args.protocol.read(), + simulate=True) diff --git a/api/opentrons/util/calibration_functions.py b/api/opentrons/util/calibration_functions.py index b1aa6d552c9..56610021986 100644 --- a/api/opentrons/util/calibration_functions.py +++ b/api/opentrons/util/calibration_functions.py @@ -3,7 +3,7 @@ from opentrons.trackers.pose_tracker import ( update, Point, change_base ) -from opentrons.robot import robot_configs +from opentrons.legacy_api.robot import robot_configs from opentrons.data_storage import database from opentrons.trackers.pose_tracker import absolute from opentrons.config import feature_flags as ff diff --git a/api/tests/opentrons/__init__.py b/api/tests/opentrons/__init__.py index b9f4fb975d2..9396d750b57 100644 --- a/api/tests/opentrons/__init__.py +++ b/api/tests/opentrons/__init__.py @@ -1,4 +1,4 @@ -from opentrons.containers.placeable import Container, Well +from opentrons.legacy_api.containers.placeable import Container, Well def generate_plate(wells, cols, spacing, offset, radius, height=0): diff --git a/api/tests/opentrons/cli/test_cli.py b/api/tests/opentrons/cli/test_cli.py index f5ce1f051fb..29374a52418 100755 --- a/api/tests/opentrons/cli/test_cli.py +++ b/api/tests/opentrons/cli/test_cli.py @@ -5,7 +5,7 @@ @pytest.fixture def mock_config(): - from opentrons.robot import robot_configs + from opentrons.legacy_api.robot import robot_configs test_config = robot_configs.load() test_config = test_config._replace(name='new-value1') @@ -21,7 +21,7 @@ def test_clear_config(mock_config): dc_main.clear_configuration_and_reload() from opentrons import robot - from opentrons.robot import robot_configs + from opentrons.legacy_api.robot import robot_configs assert robot.config == robot_configs._build_config({}, {}) @@ -42,7 +42,7 @@ def test_save_and_clear_config(mock_config): dc_main.backup_configuration_and_reload(tag=tag) from opentrons import robot - from opentrons.robot import robot_configs + from opentrons.legacy_api.robot import robot_configs assert robot.config == robot_configs._build_config({}, {}) diff --git a/api/tests/opentrons/conftest.py b/api/tests/opentrons/conftest.py index 3aad4e15c0b..ce461db894c 100755 --- a/api/tests/opentrons/conftest.py +++ b/api/tests/opentrons/conftest.py @@ -205,7 +205,7 @@ def dc_session(virtual_smoothie_env, monkeypatch): @pytest.fixture def robot(dummy_db): - from opentrons import Robot + from opentrons.legacy_api.robot import Robot return Robot() @@ -350,8 +350,8 @@ async def wait_until(matcher, notifications, timeout=1, loop=None): @pytest.fixture def model(robot): - from opentrons.containers import load - from opentrons.instruments.pipette import Pipette + from opentrons.legacy_api.containers import load + from opentrons.legacy_api.instruments.pipette import Pipette pipette = Pipette(robot, ul_per_mm=18.5, mount='right') plate = load(robot, '96-flat', '1') @@ -368,8 +368,8 @@ def model(robot): @pytest.fixture def model_with_trough(robot): - from opentrons.containers import load - from opentrons.instruments.pipette import Pipette + from opentrons.legacy_api.containers import load + from opentrons.legacy_api.instruments.pipette import Pipette pipette = Pipette(robot, mount='right') plate = load(robot, 'trough-12row', '1') @@ -388,7 +388,7 @@ def model_with_trough(robot): def smoothie(monkeypatch): from opentrons.drivers.smoothie_drivers.driver_3_0 import \ SmoothieDriver_3_0_0 as SmoothieDriver - from opentrons.robot import robot_configs + from opentrons.legacy_api.robot import robot_configs monkeypatch.setenv('ENABLE_VIRTUAL_SMOOTHIE', 'true') driver = SmoothieDriver(robot_configs.load()) diff --git a/api/tests/opentrons/containers/test_containers.py b/api/tests/opentrons/containers/test_containers.py index a17277ee34f..98719911428 100644 --- a/api/tests/opentrons/containers/test_containers.py +++ b/api/tests/opentrons/containers/test_containers.py @@ -1,17 +1,17 @@ import math import unittest -from opentrons.containers import ( +from opentrons.legacy_api.containers import ( load as containers_load, - list as containers_list + list as containers_list, ) -from opentrons import Robot -from opentrons.containers import placeable -from opentrons.containers.placeable import ( +from opentrons.legacy_api.robot import Robot +from opentrons.legacy_api.containers.placeable import ( Container, Well, Deck, - Slot) + Slot, + unpack_location) from tests.opentrons import generate_plate # TODO: Modify all calls to get a Well to use the `wells` method # TODO: remove `unpack_location` calls @@ -94,7 +94,7 @@ def test_containers_list(self): def test_bad_unpack_containers(self): self.assertRaises( - ValueError, placeable.unpack_location, 1) + ValueError, unpack_location, 1) def test_iterate_without_parent(self): c = generate_plate(4, 2, (5, 5), (0, 0), 5) diff --git a/api/tests/opentrons/containers/test_default_containers.py b/api/tests/opentrons/containers/test_default_containers.py index dd846822ea8..96b74f444b5 100755 --- a/api/tests/opentrons/containers/test_default_containers.py +++ b/api/tests/opentrons/containers/test_default_containers.py @@ -1,4 +1,4 @@ -from opentrons.containers import load as containers_load +from opentrons.legacy_api.containers import load as containers_load from opentrons import instruments, robot from opentrons.trackers import pose_tracker from numpy import isclose diff --git a/api/tests/opentrons/containers/test_grid.py b/api/tests/opentrons/containers/test_grid.py index b2ac9a0b56d..5e0e1b46d4c 100644 --- a/api/tests/opentrons/containers/test_grid.py +++ b/api/tests/opentrons/containers/test_grid.py @@ -1,8 +1,8 @@ import unittest -from opentrons.containers import load -from opentrons.instruments import pipette -from opentrons import Robot +from opentrons.legacy_api.containers import load +from opentrons.legacy_api.instruments import pipette +from opentrons.legacy_api.robot import Robot # TODO: Remove (ordering tested by new labware def test suite) diff --git a/api/tests/opentrons/containers/test_old_container_loading.py b/api/tests/opentrons/containers/test_old_container_loading.py index 3b7d9591455..310e777fd86 100755 --- a/api/tests/opentrons/containers/test_old_container_loading.py +++ b/api/tests/opentrons/containers/test_old_container_loading.py @@ -5,7 +5,7 @@ import unittest from opentrons.data_storage import old_container_loading -from opentrons.containers.placeable import Container, Well +from opentrons.legacy_api.containers.placeable import Container, Well from opentrons.util import environment from opentrons.config import feature_flags as ff # TODO: Remove diff --git a/api/tests/opentrons/containers/test_placeable.py b/api/tests/opentrons/containers/test_placeable.py index a9431373898..38a975a2a86 100644 --- a/api/tests/opentrons/containers/test_placeable.py +++ b/api/tests/opentrons/containers/test_placeable.py @@ -1,5 +1,5 @@ from math import pi -from opentrons.containers.placeable import Deck, Slot +from opentrons.legacy_api.containers.placeable import Deck, Slot from opentrons.config import feature_flags as ff from tests.opentrons import generate_plate diff --git a/api/tests/opentrons/containers/test_placeable_unittest.py b/api/tests/opentrons/containers/test_placeable_unittest.py index b0eefa2727c..b34560cffa9 100644 --- a/api/tests/opentrons/containers/test_placeable_unittest.py +++ b/api/tests/opentrons/containers/test_placeable_unittest.py @@ -1,7 +1,7 @@ import unittest import math -from opentrons.containers.placeable import ( +from opentrons.legacy_api.containers.placeable import ( Container, Well, Deck, diff --git a/api/tests/opentrons/database/test_database.py b/api/tests/opentrons/database/test_database.py index 432a2930452..701907e4db7 100755 --- a/api/tests/opentrons/database/test_database.py +++ b/api/tests/opentrons/database/test_database.py @@ -1,7 +1,7 @@ import pytest -from opentrons.containers import load as containers_load -from opentrons.containers.placeable import Well, Container +from opentrons.legacy_api.containers import load as containers_load +from opentrons.legacy_api.containers.placeable import Well, Container from opentrons.data_storage import database from opentrons.util.vector import Vector from opentrons import robot diff --git a/api/tests/opentrons/helpers/test_helpers.py b/api/tests/opentrons/helpers/test_helpers.py index e1c461e569f..9ab4ce47369 100644 --- a/api/tests/opentrons/helpers/test_helpers.py +++ b/api/tests/opentrons/helpers/test_helpers.py @@ -1,9 +1,9 @@ import unittest -from opentrons import Robot +from opentrons.legacy_api.robot import Robot from opentrons.helpers import helpers -from opentrons.instruments import pipette +from opentrons.legacy_api.instruments import pipette from opentrons.util.vector import Vector -from opentrons.containers import load as containers_load +from opentrons.legacy_api.containers import load as containers_load # TODO: Move `helpers` methods into either pipette or other non-generic place diff --git a/api/tests/opentrons/integration/test_protocol.py b/api/tests/opentrons/integration/test_protocol.py index c392f4d4d6f..e2933cab61f 100644 --- a/api/tests/opentrons/integration/test_protocol.py +++ b/api/tests/opentrons/integration/test_protocol.py @@ -1,9 +1,9 @@ import unittest -from opentrons import Robot -from opentrons.containers import load as containers_load -from opentrons.containers.placeable import Container, Deck -from opentrons.instruments import pipette +from opentrons.legacy_api.robot import Robot +from opentrons.legacy_api.containers import load as containers_load +from opentrons.legacy_api.containers.placeable import Container, Deck +from opentrons.legacy_api.instruments import pipette # TODO: Modify all calls to get a Well to use the `wells` method diff --git a/api/tests/opentrons/labware/test_pipette.py b/api/tests/opentrons/labware/test_pipette.py index 83bb0c2f4bb..1e85072bfa6 100755 --- a/api/tests/opentrons/labware/test_pipette.py +++ b/api/tests/opentrons/labware/test_pipette.py @@ -2,15 +2,15 @@ # TODO: Modify all calls to get a Well to use the `wells` method from opentrons import instruments, robot -from opentrons.containers import load as containers_load -from opentrons.instruments import Pipette +from opentrons.legacy_api.containers import load as containers_load +from opentrons.legacy_api.instruments import Pipette from opentrons.trackers import pose_tracker from numpy import isclose import pytest def test_pipette_version_1_0_and_1_3_extended_travel(): - from opentrons.instruments import pipette_config + from opentrons.legacy_api.instruments import pipette_config models = [ 'p10_single', 'p10_multi', 'p50_single', 'p50_multi', @@ -37,7 +37,7 @@ def test_pipette_version_1_0_and_1_3_extended_travel(): def test_all_pipette_models_can_transfer(): - from opentrons.instruments import pipette_config + from opentrons.legacy_api.instruments import pipette_config models = [ 'p10_single', 'p10_multi', 'p50_single', 'p50_multi', @@ -60,7 +60,7 @@ def test_all_pipette_models_can_transfer(): def test_pipette_models_reach_max_volume(): - from opentrons.instruments import pipette_config + from opentrons.legacy_api.instruments import pipette_config for model in pipette_config.configs: config = pipette_config.load(model) @@ -248,7 +248,7 @@ def test_trough_move_to(): def test_delay_calls(monkeypatch): from opentrons import robot - from opentrons.instruments import pipette + from opentrons.legacy_api.instruments import pipette robot.reset() p300 = instruments.P300_Single(mount='right') @@ -283,7 +283,7 @@ def mock_is_simulating(): @pytest.mark.xfail def test_drop_tip_in_trash(virtual_smoothie_env, monkeypatch): from opentrons import robot, labware - from opentrons.instruments.pipette import Pipette + from opentrons.legacy_api.instruments.pipette import Pipette robot.reset() robot.home() tiprack = labware.load('tiprack-200ul', '1') diff --git a/api/tests/opentrons/labware/test_pipette_constructors.py b/api/tests/opentrons/labware/test_pipette_constructors.py index a89e87cdd4a..5b1a9ed2586 100644 --- a/api/tests/opentrons/labware/test_pipette_constructors.py +++ b/api/tests/opentrons/labware/test_pipette_constructors.py @@ -1,7 +1,7 @@ # TODO: Modify all calls to get a Well to use the `wells` method import pytest from opentrons import robot, instruments -from opentrons.instruments import Pipette +from opentrons.legacy_api.instruments import Pipette factories = [ ('p10_single', instruments.P10_Single), diff --git a/api/tests/opentrons/labware/test_pipette_unittest.py b/api/tests/opentrons/labware/test_pipette_unittest.py index a941dd325fa..b4c9bf73709 100644 --- a/api/tests/opentrons/labware/test_pipette_unittest.py +++ b/api/tests/opentrons/labware/test_pipette_unittest.py @@ -3,10 +3,10 @@ import unittest from unittest import mock -from opentrons.robot.robot import Robot -from opentrons.containers import load as containers_load -from opentrons.instruments import Pipette -from opentrons.containers.placeable import unpack_location +from opentrons.legacy_api.robot import Robot +from opentrons.legacy_api.containers import load as containers_load +from opentrons.legacy_api.instruments import Pipette +from opentrons.legacy_api.containers.placeable import unpack_location from opentrons.trackers import pose_tracker from tests.opentrons.conftest import fuzzy_assert from tests.opentrons import generate_plate diff --git a/api/tests/opentrons/performance/test_performance.py b/api/tests/opentrons/performance/test_performance.py index b59065fedf2..5389df45802 100644 --- a/api/tests/opentrons/performance/test_performance.py +++ b/api/tests/opentrons/performance/test_performance.py @@ -1,8 +1,8 @@ import unittest -from opentrons import Robot -from opentrons.containers import load as containers_load -from opentrons.instruments import pipette +from opentrons.legacy_api.robot import Robot +from opentrons.legacy_api.containers import load as containers_load +from opentrons.legacy_api.instruments import pipette class PerformanceTest(unittest.TestCase): diff --git a/api/tests/opentrons/robot/test_mover.py b/api/tests/opentrons/robot/test_mover.py index 4566714634c..63c9002d316 100755 --- a/api/tests/opentrons/robot/test_mover.py +++ b/api/tests/opentrons/robot/test_mover.py @@ -1,6 +1,6 @@ from numpy import array, isclose -from opentrons.instruments import Pipette -from opentrons.robot.mover import Mover +from opentrons.legacy_api.instruments import Pipette +from opentrons.legacy_api.robot.mover import Mover from opentrons.trackers.pose_tracker import ( change_base, init, ROOT ) diff --git a/api/tests/opentrons/robot/test_robot.py b/api/tests/opentrons/robot/test_robot.py index e9efa7cb8e0..600441786c4 100644 --- a/api/tests/opentrons/robot/test_robot.py +++ b/api/tests/opentrons/robot/test_robot.py @@ -1,4 +1,4 @@ -from opentrons.containers import load as containers_load +from opentrons.legacy_api.containers import load as containers_load from opentrons import robot, instruments, labware from opentrons.trackers import pose_tracker from opentrons.util import vector @@ -113,7 +113,8 @@ def test_comment(virtual_smoothie_env): def test_create_arc(virtual_smoothie_env): - from opentrons.robot.robot import TIP_CLEARANCE_DECK, TIP_CLEARANCE_LABWARE + from opentrons.legacy_api.robot.robot import (TIP_CLEARANCE_DECK, + TIP_CLEARANCE_LABWARE) robot.reset() p300 = instruments.P300_Single(mount='left') diff --git a/api/tests/opentrons/robot/test_robots_config.py b/api/tests/opentrons/robot/test_robots_config.py index 82d9887f9cd..45bdf7d1f38 100644 --- a/api/tests/opentrons/robot/test_robots_config.py +++ b/api/tests/opentrons/robot/test_robots_config.py @@ -1,5 +1,5 @@ def test_old_probe_height(short_trash_flag): - from opentrons.robot import robot_configs + from opentrons.legacy_api.robot import robot_configs cfg = robot_configs.load() @@ -8,7 +8,7 @@ def test_old_probe_height(short_trash_flag): def test_default_probe_height(): - from opentrons.robot import robot_configs + from opentrons.legacy_api.robot import robot_configs cfg = robot_configs.load() assert cfg.probe_center[2] == 77.0 @@ -17,7 +17,7 @@ def test_default_probe_height(): def test_load_corrupt_json(): import os - from opentrons.robot import robot_configs + from opentrons.legacy_api.robot import robot_configs filename = os.path.join(os.path.dirname(__file__), 'bad_config.json') with open(filename, 'w') as file: file.write('') # empty config file @@ -27,7 +27,7 @@ def test_load_corrupt_json(): def test_build_config(): - from opentrons.robot import robot_configs + from opentrons.legacy_api.robot import robot_configs deck_cal = [ [1.23, 1.23, 1.23, 1.23], diff --git a/api/tests/opentrons/server/calibration_integration_test.py b/api/tests/opentrons/server/calibration_integration_test.py index 96d3c11d05e..54f41371152 100644 --- a/api/tests/opentrons/server/calibration_integration_test.py +++ b/api/tests/opentrons/server/calibration_integration_test.py @@ -3,7 +3,7 @@ from opentrons import deck_calibration as dc from opentrons.deck_calibration import endpoints from opentrons.trackers.pose_tracker import absolute -from opentrons.instruments.pipette_config import Y_OFFSET_MULTI +from opentrons.legacy_api.instruments.pipette_config import Y_OFFSET_MULTI # Note that several values in this file have target/expected values that do not diff --git a/api/tests/opentrons/server/test_calibration_endpoints.py b/api/tests/opentrons/server/test_calibration_endpoints.py index f0147b1bf32..08fb3a9c02d 100644 --- a/api/tests/opentrons/server/test_calibration_endpoints.py +++ b/api/tests/opentrons/server/test_calibration_endpoints.py @@ -3,7 +3,7 @@ from opentrons import robot, instruments from opentrons import deck_calibration as dc from opentrons.deck_calibration import endpoints -from opentrons.robot import robot_configs +from opentrons.legacy_api.robot import robot_configs # Note that several tests in this file have target/expected values that do not @@ -217,7 +217,7 @@ async def test_create_session_fail(async_client, monkeypatch): Tests that the GET request to initiate a session manager for factory calibration returns a good token. """ - from opentrons.robot.robot import Robot + from opentrons.legacy_api.robot import Robot dummy_token = 'Test Token' def uuid_mock(): diff --git a/api/tests/opentrons/server/test_control_endpoints.py b/api/tests/opentrons/server/test_control_endpoints.py index 2418708b9a3..b35e83751bf 100644 --- a/api/tests/opentrons/server/test_control_endpoints.py +++ b/api/tests/opentrons/server/test_control_endpoints.py @@ -4,7 +4,7 @@ from opentrons.server import init from opentrons.drivers.smoothie_drivers.driver_3_0 import SmoothieDriver_3_0_0 from opentrons import instruments -from opentrons.instruments import pipette_config +from opentrons.legacy_api.instruments import pipette_config async def test_get_pipettes_uncommissioned( diff --git a/api/tests/opentrons/server/test_settings_endpoints.py b/api/tests/opentrons/server/test_settings_endpoints.py index 3edd292d378..d8b9eec5feb 100644 --- a/api/tests/opentrons/server/test_settings_endpoints.py +++ b/api/tests/opentrons/server/test_settings_endpoints.py @@ -6,7 +6,7 @@ from opentrons.server import init from opentrons.data_storage import database as db -from opentrons.robot import robot_configs as rc +from opentrons.legacy_api.robot import robot_configs as rc def validate_response_body(body): diff --git a/api/tests/opentrons/util/test_tip_probe.py b/api/tests/opentrons/util/test_tip_probe.py index c5fb65183f0..2cc79c2aacb 100755 --- a/api/tests/opentrons/util/test_tip_probe.py +++ b/api/tests/opentrons/util/test_tip_probe.py @@ -1,5 +1,5 @@ import pytest -from opentrons.robot import robot_configs +from opentrons.legacy_api.robot import robot_configs from opentrons.config import get_config_index from opentrons.util.calibration_functions import update_instrument_config @@ -42,8 +42,8 @@ def dummy_default(a, b): @pytest.fixture def fixture(config, monkeypatch): - from opentrons.robot.robot import Robot - from opentrons.instruments.pipette import Pipette + from opentrons.legacy_api.robot import Robot + from opentrons.legacy_api.instruments.pipette import Pipette from collections import namedtuple from opentrons.drivers.smoothie_drivers import driver_3_0