uf.routes#

API routes for uf web interface.

Provides convenience routes for the web UI, including function listing, spec retrieval, and the main HTML interface.

Functions

add_ui_routes(app, function_specs, *[, ...])

Add UI routes to a qh app.

create_function_handler(func, func_name)

Create a request handler for a function.

uf.routes.add_ui_routes(app, function_specs, *, page_title='Function Interface', custom_css=None, rjsf_theme='default')[source]#

Add UI routes to a qh app.

Adds the following routes:

  • GET / : Main UI page (HTML)

  • GET /api/functions : List available functions (JSON)

  • GET /api/functions/{name}/spec : Get RJSF spec for function (JSON)

Parameters:
  • app (Any) – The qh/bottle/fastapi app to add routes to

  • function_specs (Mapping) – FunctionSpecStore with function specifications

  • page_title (str) – Title for the web interface

  • custom_css (str) – Optional custom CSS

  • rjsf_theme (str) – RJSF theme to use

Return type:

None

Note

This function detects whether the app is using Bottle or FastAPI and adds routes accordingly.

uf.routes.create_function_handler(func, func_name)[source]#

Create a request handler for a function.

This wraps the function to handle HTTP requests and responses.

Parameters:
  • func (Callable) – The function to wrap

  • func_name (str) – Name of the function

Return type:

Callable

Returns:

A handler function compatible with web frameworks