-
Notifications
You must be signed in to change notification settings - Fork 2
Description
I am recording changes I didn't expect when moving the OpenFlexure microscope server from LabThings 0.0.11 to 0.0.12. It may be decided that these are fine, it may be decided that they are regressions.
We can decide which of these to make specific issues for later:
lt.cli.from_serveris nowlt.ThingServer.from_config- Extra keys no longer allowed in server config - The microscope uses extra keys to defined other non-LabThings configuration. I can see this being dangerous. Perhaps allowing an arbitrary dictionary in "app_config" or similar?
lt.cli.object_reference_to_objectis gone.- There are no docs for creating a fallback sever that I can find from searching
fallbackin the readthedocs, the only page I find says "we will still start an HTTP", but gives no code for how "we" do this.
If the fallback option is given when labthings-server is run, we will still start an HTTP server even if we cannot run LabThings with the specified configuration. This means that something will still be viewable at the expected URL, which is helpful if LabThings is running as a service, or on embedded hardware.
- I note that this might be that we don't use
serve_from_cliwhich I think is the expected method. However,serve_from_clidoesn't allow us do get any of our own configuration information for start up and server customisation. In which case we probably want an issue Create defined way to read custom config, add parser_args, and customiser server
- There are no docs for creating a fallback sever that I can find from searching
- Config file appears to have changed (beyond the removing
/s from names). I have no idea what is wrong, I am getting lots of unhelpful errors Pydantic errors.pydantic_core._pydantic_core.ValidationError: 8 validation errors for ThingServerConfig
things.camera.ThingConfig
Input should be a valid dictionary or instance of ThingConfig [type=model_type, input_value='openflexure_microscope_s...ulation:SimulatedCamera', input_type=str]
For further information visit https://errors.pydantic.dev/2.10/v/model_type
things.camera.function-plain[import_string()]
Value error, A getter was specified at the same time as a default. Only one of a getter, default, and default_factory may be used. [type=value_error, input_value='openflexure_microscope_s...ulation:SimulatedCamera', input_type=str]
For further information visit https://errors.pydantic.dev/2.10/v/value_error
things.stage.ThingConfig
Input should be a valid dictionary or instance of ThingConfig [type=model_type, input_value='openflexure_microscope_s....stage.dummy:DummyStage', input_type=str]
For further information visit https://errors.pydantic.dev/2.10/v/model_type
things.stage.function-plain[import_string()]
Value error, A getter was specified at the same time as a default. Only one of a getter, default, and default_factory may be used. [type=value_error, input_value='openflexure_microscope_s....stage.dummy:DummyStage', input_type=str]
For further information visit https://errors.pydantic.dev/2.10/v/value_error
things.autofocus.ThingConfig
Input should be a valid dictionary or instance of ThingConfig [type=model_type, input_value='openflexure_microscope_s...utofocus:AutofocusThing', input_type=str]
For further information visit https://errors.pydantic.dev/2.10/v/model_type
things.autofocus.function-plain[import_string()]
Value error, A getter was specified at the same time as a default. Only one of a getter, default, and default_factory may be used. [type=value_error, input_value='openflexure_microscope_s...utofocus:AutofocusThing', input_type=str]
For further information visit https://errors.pydantic.dev/2.10/v/value_error
things.camera_stage_mapping.ThingConfig
Input should be a valid dictionary or instance of ThingConfig [type=model_type, input_value='openflexure_microscope_s...pping:CameraStageMapper', input_type=str]
For further information visit https://errors.pydantic.dev/2.10/v/model_type
things.camera_stage_mapping.function-plain[import_string()]
Value error, A getter was specified at the same time as a default. Only one of a getter, default, and default_factory may be used. [type=value_error, input_value='openflexure_microscope_s...pping:CameraStageMapper', input_type=str]
For further information visit https://errors.pydantic.dev/2.10/v/value_error- About a hour into debugging this I am starting to realise it might not be the configuration. If might be that you are inside a pydantic model when trying to import and therefore other errors are not propagated sensibly?
- Right it seems to be certain issues
lt.propertycause config to create a mess in pydantic. I did have one mistake where I had a value before default because I hadn't deleted the type (which had no keyword), also some properties hadobservableset still, which is maybe deleted!?. We probably need to create an issue Errors in property definitions cause stange pydantic errors when loading config (Issue No traceback for ValueErrors or TypeErrors when importing Things #222)
observableseems to have been removed from properties?server.thing_descriptions() gives the wrongFixed with Fix urls for affordances in the server thing descriptions #224hreffor each affordance. (Issue Server thing descriptions have wrong href for affordances #221)- no access to
BlockingPortal.call. PR Addcall_async_tasktothing_server_interfaceallowing access toBlockingPortal.call#225 adds an interface for this lt.ThingClient.from_urluses "/camera/" rather than "camera", which makes sense as it is url, but it caught out my automatic renaming, and the error message wasn't helpful. I ended up searching the test code inlabthings-fastapi