From 707995f68208e2301630aa001c876dc96ce01078 Mon Sep 17 00:00:00 2001 From: Jules BOURDAIS Date: Wed, 27 May 2026 12:00:24 +0200 Subject: [PATCH] docs(handler): docker information --- examples/handler/README_DOCKER.md | 2 +- trame_client/widgets/trame.py | 16 ++++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/examples/handler/README_DOCKER.md b/examples/handler/README_DOCKER.md index d7e5afb..c340703 100644 --- a/examples/handler/README_DOCKER.md +++ b/examples/handler/README_DOCKER.md @@ -3,5 +3,5 @@ This can work out of the box with the default docker bundle. All you have to do is updating the `setup/initialize.sh` script to run the app once so that asset collection can occur. Example: ```bash -uv run your-trame-app-entrypoint --timeout 1 +python -m your-trame-app-entrypoint --timeout 1 --server ``` diff --git a/trame_client/widgets/trame.py b/trame_client/widgets/trame.py index 6d598f0..f2cdaab 100644 --- a/trame_client/widgets/trame.py +++ b/trame_client/widgets/trame.py @@ -375,6 +375,7 @@ def register_external_script( Args: script_file_path (Path | str): The local of the script you want to register. Can be either a local or a remote script. Accepts: + - `Path`: local path to your script on the filesystem - `str`: an valid URL to the script function_names (list[str]): public API of your script that you want to expose to the Handler widget. @@ -414,13 +415,15 @@ class Handler(AbstractElement): It manages the execution flow between the Python state and JavaScript functions, providing events to monitor execution status. + For usage with the docker setup, please see `README_DOCKER.md `_. + Args: function (UserDefinedFunction | tuple[str, str] | ExternalScript | str): The JavaScript function to execute. Accepts: + - `UserDefinedFunction`: Obtained from `ExternalScript.function`. - `tuple[str, str]`: A `(module_name, function_name)` pair. - - `ExternalScript`: An object from `register_external_script` (must - contain exactly one function). + - `ExternalScript`: An object from `register_external_script` (must contain exactly one function). - `str`: The registration identifier of an external script. variable (str): The name of the state variable to be passed as the primary input to the function. @@ -430,10 +433,11 @@ class Handler(AbstractElement): to be passed as arguments to the function. Defaults to None. Events: - completed: A generic event emitted regardless of the execution outcome. - success: Emitted when the function executes and returns successfully. - failure: Emitted when the function reports a handled error. - error: Emitted when an unhandled exception occurs during execution. + + - completed: A generic event emitted regardless of the execution outcome. + - success: Emitted when the function executes and returns successfully. + - failure: Emitted when the function reports a handled error. + - error: Emitted when an unhandled exception occurs during execution. """ def __init__(