Skip to content

Commit 4a68652

Browse files
mscolnickLight2Dark
authored andcommitted
improvement: configurable skew protection in create_asgi_app, default False (#5585)
Allow configuring `skew_protection` when running marimo programmatically with `create_asgi_app`. The default is set to `False`
1 parent d36d05f commit 4a68652

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

marimo/_server/asgi.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,7 @@ def create_asgi_app(
296296
quiet: bool = False,
297297
include_code: bool = False,
298298
token: Optional[str] = None,
299+
skew_protection: bool = False,
299300
) -> ASGIAppBuilder:
300301
"""Public API to create an ASGI app that can serve multiple notebooks.
301302
This only works for application that are in Run mode.
@@ -305,6 +306,8 @@ def create_asgi_app(
305306
include_code (bool, optional): Include notebook code in the app
306307
token (str, optional): Auth token to use for the app.
307308
If not provided, an empty token is used.
309+
skew_protection (bool, optional): Enable skew protection middleware to prevent version mismatch issues.
310+
e.g. if the server is updated, the client will be prompted to reload.
308311
309312
Returns:
310313
ASGIAppBuilder: A builder object to create multiple ASGI apps
@@ -477,6 +480,7 @@ def _create_app_for_file(base_url: str, file_path: str) -> ASGIApp:
477480
),
478481
enable_auth=not AuthToken.is_empty(auth_token),
479482
allow_origins=("*",),
483+
skew_protection=skew_protection,
480484
)
481485
app.state.session_manager = session_manager
482486
app.state.base_url = base_url

0 commit comments

Comments
 (0)