Refactor shaker API and move BioShake to shaking module#905
Merged
rickwierenga merged 3 commits intoPyLabRobot:mainfrom Feb 24, 2026
Merged
Refactor shaker API and move BioShake to shaking module#905rickwierenga merged 3 commits intoPyLabRobot:mainfrom
rickwierenga merged 3 commits intoPyLabRobot:mainfrom
Conversation
Comment on lines
3
to
4
| from pylabrobot.heating_shaking.backend import HeaterShakerBackend | ||
| from pylabrobot.heating_shaking.bioshake_backend import BioShake | ||
| from pylabrobot.heating_shaking.chatterbox import HeaterShakerChatterboxBackend |
pylabrobot/shaking/backend.py
Outdated
Comment on lines
18
to
30
| async def shake(self, speed: float): | ||
| """Deprecated alias for ``start_shaking``. | ||
|
|
||
| Backends should implement ``start_shaking``. This method exists for backwards compatibility. | ||
| """ | ||
|
|
||
| warnings.warn( | ||
| "ShakerBackend.shake() is deprecated. Use start_shaking() instead.", | ||
| DeprecationWarning, | ||
| stacklevel=2, | ||
| ) | ||
| await self.start_shaking(speed=speed) | ||
|
|
Member
There was a problem hiding this comment.
this is not needed since this method is just abstract and never called
| print("Stopping shaker") | ||
|
|
||
| async def shake(self, speed: float): | ||
| async def start_shaking(self, speed: float): |
pylabrobot/shaking/shaker.py
Outdated
Comment on lines
56
to
61
| async def start_shaking(self, speed: float, **backend_kwargs): | ||
| """Start shaking indefinitely at the given speed.""" | ||
| if self.backend.supports_locking: | ||
| await self.backend.lock_plate() | ||
| await self.backend.start_shaking(speed=speed, **backend_kwargs) | ||
|
|
Member
There was a problem hiding this comment.
what is the point of this method when we already have shake? shake has duration, but also supports start_shaking. this makes the api ambiguous: which method should be used?
Contributor
Author
There was a problem hiding this comment.
My bad, removed start_shaking from the frontend. "shake" with duration None is the correct way to shake indefinitely.
rickwierenga
added a commit
that referenced
this pull request
Feb 24, 2026
This reverts commit 8adab4d.
rickwierenga
added a commit
that referenced
this pull request
Feb 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR does two related refactors:
heating_shakingtoshaking, since BioShake is shaker-only.start_shaking(...)at the backend layer, while keeping frontendshake(..., duration=...)as the orchestration method.Motivation
ShakerBackend.shake()was semantically “start shaking”, which was easy-to-confuse with frontendShaker.shake(..., duration=...)behavior.start_shaking/stop_shakingis clearer and consistent.pylabrobot.shaking.Changes
BioShake module placement
pylabrobot/shaking/bioshake_backend.pypylabrobot/shaking/__init__.pypylabrobot/heating_shaking/bioshake_backend.pyShaker backend API rename
ShakerBackendnow defines abstract:start_shaking(speed: float)ShakerBackend.shake(...)forwards tostart_shaking(...)with warningFrontend updates
Shaker.shake(..., duration=...)now callsbackend.start_shaking(...)Backend implementations updated
pylabrobot/shaking/chatterbox.py: implementsstart_shaking(...), keeps deprecatedshake(...)pylabrobot/shaking/bioshake_backend.py: implementsstart_shaking(...), keeps deprecatedshake(...)pylabrobot/heating_shaking/hamilton_backend.py: implementsstart_shaking(...), keeps deprecatedshake(...)pylabrobot/heating_shaking/inheco/thermoshake_backend.py: implementsstart_shaking(...), keeps deprecatedshake(...)Backward compatibility
.shake(...)still work for now via deprecation aliases.heating_shakingstill works via shim.from pylabrobot.shaking import BioShakestart_shaking(...)/stop_shaking(...)Testing / validation
Follow-up (optional)
Shaker.shake(..., duration=...)usesstart_shaking(...)thenstop_shaking(...).shake(...)aliases and theheating_shakingBioShake shim.