-
Notifications
You must be signed in to change notification settings - Fork 178
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
feat(api): add liquid class in PAPI #16506
Conversation
|
||
|
||
class LiquidClassDefinitionDoesNotExist(Exception): | ||
"""Specified liquid class' definition does not exist.""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this has to be possessive.
"""Specified liquid class' definition does not exist.""" | |
"""Specified liquid class definition does not exist.""" |
# Calling this often will degrade protocol execution performance. | ||
liquid_class_def = liquid_classes.load_definition(name) | ||
self._defined_liquid_class_defs_by_name[name] = liquid_class_def | ||
except KeyError: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldnt this be LiquidClassDefinitionDoesNotExist
and not KeyError
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, small nitpick but otherwise 👍
def get_for(self, pipette: str, tiprack: str) -> TransferProperties: | ||
"""Get liquid class transfer properties for the specified pipette and tip.""" | ||
settings_for_pipette: Sequence[ByPipetteSetting] = list( | ||
filter( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is more of a style preference, but I much prefer having list comprehensions here rather than lambda expressions. Not only are they more efficient (no list
call and function calls), I find them easier to read.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need a feature flaG? can we just hold it out of docs?
I feel like feature flags, with the 'internal use' warning, set clear expectations that this code is not built for external use and can/will change without notice or version change. Do you think it's not a good idea? |
I think it's fine. I just think it can be hard to do if one of the things you want it to control is like, "added a new entry to an enum", but for this it def works |
AUTH-835, AUTH-836 # Overview Adds `LiquidClass` class and `ProtocolContext.define_liquid_class()` to PAPI. Also adds an `allowLiquidClasses` feature flag that will need to be set to True in order to use the new API method. ## Changelog - added `LiquidClass` dataclass to PAPI - added `ProtocolContext.define_liquid_class` to define a liquid class in the protocol - added `allowLiquidClasses` internal feature flag Some small schema changes: - changed `liquidName` -> `liquidClassName` and made it a `safestring` - added a `displayName` - changed `tipType` -> tiprack Misc shared data changes: - added `liquid_classes.load_definition()` - added validation tests for liquid class definitions
AUTH-835, AUTH-836
Overview
Adds
LiquidClass
class andProtocolContext.define_liquid_class()
to PAPI. Also adds anallowLiquidClasses
feature flag that will need to be set to True in order to use the new API method.Test Plan and Hands on Testing
I think the integration and unit tests in the PR are good enough for this work. This PR doesn't add the ability to actually use the liquid class in any way other than fetching values of the class so there isn't anything to be tested on a robot.
Changelog
LiquidClass
dataclass to PAPIProtocolContext.define_liquid_class
to define a liquid class in the protocolallowLiquidClasses
internal feature flagSome small schema changes:
liquidName
->liquidClassName
and made it asafestring
displayName
tipType
-> tiprackMisc shared data changes:
liquid_classes.load_definition()
Review requests
LiquidClass
structure make sense?byTipType
. ButbyTiprackType
also didn't feel correct. So looking for suggestions for improvement or reassurance that it's fine the way it is.Risk assessment
Low. Doesn't affect anything existing, and is behind a feature flag.