@@ -27,10 +27,30 @@ def imperative_server_mount(
2727 server : Type [_S ],
2828 host : str ,
2929 port : int ,
30+ shared : bool = False ,
31+ server_options : Optional [Any ] = None ,
3032 run_options : Optional [Dict [str , Any ]] = None ,
31- server_options : Optional [Dict [str , Any ]] = None ,
3233) -> Tuple [_S , Callable [[ElementConstructor ], None ]]:
33- mount , element = hotswap ()
34- server_instance = server (element ).configure (server_options or {})
34+ """Set up a server whose view can be swapped out on the fly.
35+
36+ In other words this allows the user to work with IDOM in an imperative manner.
37+ Under the hood this uses the :func:`idom.widgets.common.hotswap` function to
38+ switch out views on the fly.
39+
40+ Parameters:
41+ server: The server type to start up as a daemon
42+ host: The server hostname
43+ port: The server port number
44+ shared: Whether or not all views from the server should be updated when swapping
45+ server_options: Value passed to :meth:`AbstractRenderServer.configure`
46+ run_options: Keyword args passed to :meth:`AbstractRenderServer.daemon`
47+
48+ Returns:
49+ The server instance and a function for swapping out the view.
50+ """
51+ mount , element = hotswap (shared )
52+ server_instance = server (element )
53+ if server_options :
54+ server_instance .configure (server_options )
3555 server_instance .daemon (host , port , ** (run_options or {}))
3656 return server_instance , mount
0 commit comments