httk.serve.optimade.runtime

Public ASGI application and development-server helpers.

Submodules

Functions

create_app(*, query_function, config, schema[, ...])

Create a mount-aware ASGI application for an explicit schema and query callback.

run_dev_server(*, app, host, port)

Run an ASGI application with Uvicorn.

Package Contents

httk.serve.optimade.runtime.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 baseurl is authoritative. Without one, the application derives links from the request origin and ASGI root_path, preserving the mount path and exactly one version segment. CORS remains disabled unless config.cors_origins contains a bounded exact allow-list; request report collections are merged into response warnings, including error responses.

Parameters:
Returns:

Configured Starlette ASGI application.

Raises:

ValueError – If configured CORS origins are invalid or excessive.

Return type:

starlette.applications.Starlette

httk.serve.optimade.runtime.run_dev_server(*, app, host, port)[source]

Run an ASGI application with Uvicorn.

Parameters: