exlab_wizard.api.setup#
Setup-state gate + /setup/* endpoints. Backend Spec §4.6, §4.9.
Two responsibilities live here:
The setup-state gate – a per-request dependency that consults
paths.evaluate_setup_state()and returns 503 withcode: "setup_incomplete"for routes that need a completeconfig.yaml(creation, browse, problems). Routes that must remain available during onboarding (/setup/*,/config,/health) skip the dependency.The setup endpoints –
GET /setup/status,POST /setup/test-lims,POST /setup/test-equipment,POST /setup/autostart. These are the wizard’s “diagnostics” surface and must work in any setup state.
Per Backend §4.9.4, INCOMPLETE_LIMS_UNREACHABLE is a soft block:
the gate treats it as READY for endpoint-gating purposes; the
/setup/status endpoint surfaces the soft state separately so the
banner can render.
Functions
Construct the |
|
|
Evaluate the §4.9.1 state for the app's current dependencies. |
|
Return True when |
|
FastAPI dependency that gates a route on setup state. |
Classes
|
|
|
|
|
|
|
|
|
Common |
|
|
- class exlab_wizard.api.setup.AutostartRequest(**data)[source]#
Bases:
BaseModelPOST /setup/autostartrequest body. Backend Spec §4.9.5 step 0.- Parameters:
data (
Any)
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid'}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class exlab_wizard.api.setup.EquipmentTestRequest(**data)[source]#
Bases:
BaseModelPOST /setup/test-equipmentrequest body.- Parameters:
data (
Any)
- equipment: EquipmentConfig | None#
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid'}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class exlab_wizard.api.setup.LIMSTestRequest(**data)[source]#
Bases:
BaseModelPOST /setup/test-limsrequest body.Either reference the currently-configured LIMS settings (no body fields) or supply a
LIMSConfigcandidate to test before save.Class is named
LIMSTestRequest(rather thanTestLIMSRequest) so pytest does not pick it up as a test class on collection.- Parameters:
data (
Any)
- lims: LIMSConfig | None#
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid'}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class exlab_wizard.api.setup.ProbeResult(**data)[source]#
Bases:
BaseModelCommon
ok/reasonpayload for the diagnostics endpoints.- Parameters:
data (
Any)
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid'}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class exlab_wizard.api.setup.SetupStatusResponse(**data)[source]#
Bases:
BaseModelGET /setup/statusresponse. Backend Spec §4.9.3.- Parameters:
data (
Any)
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid'}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- exlab_wizard.api.setup.TestEquipmentRequest#
alias of
EquipmentTestRequest
- exlab_wizard.api.setup.TestLIMSRequest#
alias of
LIMSTestRequest
- exlab_wizard.api.setup.TestResult#
alias of
ProbeResult
- exlab_wizard.api.setup.build_setup_router()[source]#
Construct the
/setup/*router. Always-available endpoints.- Return type:
- exlab_wizard.api.setup.compute_setup_state(deps)[source]#
Evaluate the §4.9.1 state for the app’s current dependencies.
The dependency object exposes
configand alims_reachableboolean (cached at startup; thePOST /setup/test-limsendpoint refreshes it).- Parameters:
deps (
Any)- Return type:
SetupState
- exlab_wizard.api.setup.is_creation_blocked(state)[source]#
Return True when
stateshould gate creation flows.Per §4.9.4 the soft block (
INCOMPLETE_LIMS_UNREACHABLE) does NOT gate creation – the operator may be on an offline machine using the cached project list.READYobviously does not gate.- Parameters:
state (
SetupState)- Return type:
- exlab_wizard.api.setup.setup_state_gate(request)[source]#
FastAPI dependency that gates a route on setup state.
Looks up the app’s bound
AppDependencies, evaluates the setup state, and raises 503 with the §4.9.2 envelope when the state is any non-soft INCOMPLETE_*. The dependency itself is a plain function so it can be overridden in tests viaapp.dependency_overrides.