deck server/client over a remote API#896
Open
Koeng101 wants to merge 2 commits intoPyLabRobot:mainfrom
Open
Conversation
Serve a Deck's resource tree over HTTP so a LiquidHandler on another machine (or process) can use it as a drop-in replacement. The server wraps a real Deck and exposes 31 RPCs covering tree retrieval, spatial queries, volume/tip tracker mutations, and structure changes. The client (RemoteDeck) fetches the tree on connect and builds local proxy objects that pass isinstance checks (WellProxy IS-A Well, etc.) while delegating spatial computations and state mutations to the server. Design decisions: - ConnectRPC (connect-python) over plain REST because it gives us typed proto schemas, generated client/server stubs, and the Connect protocol works over standard HTTP/1.1 (no gRPC infrastructure needed). - Proxies inherit from real resource types so backends that do isinstance(resource, Well) etc. work unchanged. A _SpatialMixin factors out the 7 overridden spatial methods. - Immutable data (name, sizes, material properties, ordering) is held locally; mutable state (tracker volumes, tip presence, lid state, computed locations) always goes to the server to avoid staleness. - connect-python stubs are hand-written (matching their codegen pattern) to avoid a build-time protoc-gen-connect-python dependency; the protobuf pb2/pyi files are generated via grpc_tools.protoc. New optional dependency group: pip install PyLabRobot[remote] Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
This PR adds a remote backend for the deck. This can be shared across many instances.
The key difference is that the deck can now be accessed through a standard API. This can be just in-memory (as it is right now), but it is now trivial to add a custom backing - whether that be SQL or document store or JSON files or anything else.
The concept is that you can have a server directly connected to a robot controlling it, but have the resource model be on a centralized server for state management.