httk.serve.optimade.runtime.asgi¶
Mount-aware Starlette runtime for the generic OPTIMADE engine.
Functions¶
|
Create a mount-aware ASGI application for an explicit schema and query callback. |
Module Contents¶
- httk.serve.optimade.runtime.asgi.create_app(*, query_function, config, schema, baseurl=None, debug=False, report_level='warning', report_context_levels=None, snapshot_cutoff_ns=None)[source]¶
Create a mount-aware ASGI application for an explicit schema and query callback.
An explicit
baseurlis authoritative. Without one, the application derives links from the request origin and ASGIroot_path, preserving the mount path and exactly one version segment. CORS remains disabled unlessconfig.cors_originscontains a bounded exact allow-list; request report collections are merged into response warnings, including error responses.- Parameters:
query_function (httk.serve.optimade.model.results.QueryFunction) – Callback that executes entry queries.
config (httk.serve.optimade.model.config.OptimadeConfig) – Service and runtime configuration.
schema (httk.serve.optimade.schema.served.ServedSchema) – Required schema describing served entries and properties.
baseurl (str | None) – Authoritative public API base URL, or
Nonefor derivation.debug (bool) – Enable Starlette and backend diagnostics.
report_level (str | int) – Minimum report level collected per request.
report_context_levels (collections.abc.Mapping[str, str | int] | None) – Context-specific report levels.
snapshot_cutoff_ns (httk.serve.optimade.engine.processing.SnapshotCutoff | None) – Optional stored-backend snapshot capability.
- Returns:
Configured Starlette ASGI application.
- Raises:
ValueError – If configured CORS origins are invalid or excessive.
- Return type: