httk.serve.optimade.api

Public helpers for creating and running generic OPTIMADE applications.

Functions

create_asgi_app(adapter[, config, baseurl, debug, ...])

Create an ASGI application serving an OPTIMADE API for a backend or store.

create_index_asgi_app(config, *[, baseurl, debug, ...])

Create an ASGI application for an OPTIMADE index meta-database.

serve(adapter[, config, host, port, baseurl, debug, ...])

Serve an OPTIMADE API for a backend or entry store with a development server.

Module Contents

httk.serve.optimade.api.create_asgi_app(adapter, config=None, *, baseurl=None, debug=False, report_level='warning', report_context_levels=None)[source]

Create an ASGI application serving an OPTIMADE API for a backend or store.

An absent baseurl makes the application derive a mount-aware URL from the request. An explicit value is authoritative.

Parameters:
Returns:

Configured serving application.

Return type:

httk.serve.http.ServeApp

httk.serve.optimade.api.create_index_asgi_app(config, *, baseurl=None, debug=False, report_level='warning', report_context_levels=None)[source]

Create an ASGI application for an OPTIMADE index meta-database.

The index serves only discovery, links, and unversioned version negotiation. It has no backend adapter and performs no query calls. The supplied configuration is retained as the response metadata source; the composed application’s caller owns its lifetime and configuration.

Parameters:
Returns:

Configured serving application.

Raises:

TypeError – If config is not an OptimadeIndexConfig.

Return type:

httk.serve.http.ServeApp

httk.serve.optimade.api.serve(adapter, config=None, *, host='127.0.0.1', port=8080, baseurl=None, debug=False, report_level='warning', report_context_levels=None)[source]

Serve an OPTIMADE API for a backend or entry store with a development server.

Parameters: