yera.ui.run
Entry point for launching Yera applications via a local server.
Symbols
discover_apps
discover_apps(
directory: Path | str,
) → dict[str, AppFunctionWrapper]Discover all apps in a directory.
Scans the directory tree for .py files and loads all apps from each
file. Hidden directories (names starting with .) are not entered, so
typical trees like .venv or .git are skipped. Files that fail to
load are logged and skipped rather than aborting the scan.
Keys are produced by extract_apps_from_py_file and embed the file path
verbatim, so they follow the form of directory: pass a relative path and
the keys are relative.
Parameters
Directory to scan for app files.
Returns
Mapping of app key to wrapper, across every file scanned.
Raises
If the directory does not exist.
If the path is not a directory.
extract_apps_from_py_file
extract_apps_from_py_file(
file_path: Path | str,
) → dict[str, AppFunctionWrapper]Extract AppFunctionWrapper instances from a Python file.
Parameters
Path to the Python file containing apps.
Returns
Mapping of app identifiers to wrappers. Keys embed file_path verbatim, so they follow the form the caller supplied.
Raises
If the specified file does not exist.
If the module cannot be loaded.
start_server_process
start_server_process(
apps: dict[str, AppFunctionWrapper],
host: str,
port: int,
open_browser: bool,
launch_config: ServerLaunchConfig | None = None,
) → NoneStart the YeraServer for the given apps and open the UI in a browser.
Runs until SIGINT or SIGTERM, then shuts the server down cleanly.
Parameters
The applications to be served.
The hostname or IP address to bind the server to.
The TCP port to listen on.
Whether to open a browser window on server start.
Configuration controlling server entry behavior.