Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(api): remove legacy from names of variables and classes that are not actually legacy #15075

Merged
merged 4 commits into from
May 6, 2024

Conversation

jbleon95
Copy link
Contributor

@jbleon95 jbleon95 commented May 2, 2024

Overview

Sometime ago, a number of classes in our protocol_runner folder were marked as legacy with the thought that we'd move to a new major API version and those would no longer be the actively developed parts of our protocol reading and execution.

However this proved not to be the cases, and for the past couple years these have continued to be marked as legacy despite the fact that they are being actively used now and for the foreseeable future. Furthermore, there are a number of folders, classes and variables that are marked legacy which are actually legacy parts of our system, further increasing confusion of what is current and what is deprecated/no longer in active development.

This PR renames everything in the protocol_runner that was prematurely marked as legacy, and additionally gets rid of a bunch of re-exports that were further naming things that are no longer legacy.

Test Plan

Pure refactor PR, so existing unit and integration tests cover everything.

Changelog

  • a bunch of internal renaming, but the most outward facing changes are renaming legacy_wrappers.py to python_protocol_wrappers.py, LegacyFileReader to PythonProtocolFileReader, LegacyContextCreator to ProtocolContextCreator, and LegacyExecutor to PythonProtocolExecutor

Review requests

Is there anything I either missed or incorrectly labelled as no longer legacy but which in fact is. I also removed the export renaming of LoadInfo since the fact that it's legacy is shown by the fact its in the correctly named legacy folder of protocol_api, but if this is a step too far I can revert those changes.

Risk assessment

Low, refactor only PR.

Copy link
Member

@sanni-t sanni-t left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So glad this is happening! Added some soft suggestions.

Comment on lines 20 to 23
LoadInfo,
LabwareLoadInfo,
InstrumentLoadInfo,
ModuleLoadInfo,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do prefer these to be aliased as LegacyLoadInfo, etc because they actually are classes from/for the legacy system.

@@ -63,24 +44,24 @@
LEGACY_JSON_SCHEMA_VERSION_CUTOFF = 6


class LegacyFileReader:
class PythonProtocolFileReader:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about PythonAndLegacyFileReader to be consistent with the PythonAndLegacyRunner, and also since it actually does include the legacy JSON protocol files.

@@ -129,7 +129,7 @@ def _handle_legacy_command(self, command: LegacyCommand) -> None:
pe_actions = self._legacy_command_mapper.map_command(command=command)
self._actions_to_dispatch.put(pe_actions)

def _handle_equipment_loaded(self, load_info: LegacyLoadInfo) -> None:
def _handle_equipment_loaded(self, load_info: LoadInfo) -> None:
"""Handle an equipment load reported by the APIv2 protocol.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can update these docstrings to be clearer too.

Suggested change
"""Handle an equipment load reported by the APIv2 protocol.
"""Handle an equipment load reported by the legacy APIv2 protocol.

Copy link
Member

@sanni-t sanni-t left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@jbleon95 jbleon95 merged commit d258233 into edge May 6, 2024
20 checks passed
@jbleon95 jbleon95 deleted the remove_incorrect_legacy_naming branch May 6, 2024 13:57
Carlos-fernandez pushed a commit that referenced this pull request May 20, 2024
Carlos-fernandez pushed a commit that referenced this pull request Jun 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants