Convert Stage to a Protocol

The Stage is now implemented as a runtime-checkable Protocol.

Part of this led to the realisation that we can't create a DirectThingClient
based on a Protocol, only on a concrete Thing. While it might be
a good idea to address that in LabThings in due course, for now
we work around it by creating both a Protocol and a stub class. The stub class implements the protocol, and
can be used to declare a dependency.
This commit is contained in:
Richard Bowman 2024-11-29 12:53:04 +00:00
parent 2e2e877d75
commit a0fbbc3e40
7 changed files with 77 additions and 25 deletions

View file

@ -21,11 +21,10 @@ from labthings_fastapi.decorators import thing_action
from labthings_fastapi.types.numpy import NDArray
from .camera import RawCameraDependency as Camera
from .camera import CameraDependency as WrappedCamera
from .stage import Stage as StageThing
from .stage import StageDependency as Stage
import numpy as np
from pydantic import BaseModel
Stage = direct_thing_client_dependency(StageThing, "/stage/")
### Autofocus utilities