2121
2222
2323async def start_matlab_proxy_for_kernel (
24- caller_id : str , parent_id : str , is_shared_matlab : bool , base_url_prefix : str = ""
24+ caller_id : str ,
25+ parent_id : str ,
26+ is_shared_matlab : bool ,
27+ base_url_prefix : str = "" ,
28+ ** kwargs ,
2529):
2630 """
2731 Starts a MATLAB proxy server specifically for MATLAB Kernel.
2832
2933 This function is a wrapper around the `start_matlab_proxy` function, with mpm_auth_token
3034 set to None, for starting the MATLAB proxy server via proxy manager.
35+
36+ Args:
37+ caller_id (str): The identifier for the caller (kernel id).
38+ parent_id (str): The context in which the server is being started (parent pid).
39+ is_shared_matlab (bool): Flag indicating if the MATLAB proxy is shared.
40+ base_url_prefix (str, optional): Custom URL path which gets added to mwi_base_url. Defaults to "".
41+ **kwargs: Additional keyword arguments:
42+ env (Dict[str, str], optional): Dictionary of environment variables to set for the
43+ MATLAB proxy process. These variables can control various aspects of the MATLAB proxy
44+ behavior. Defaults to None.
45+
46+ Returns:
47+ dict: A dictionary representation of the server process, including any errors encountered.
3148 """
3249 return await _start_matlab_proxy (
3350 caller_id = caller_id ,
3451 ctx = parent_id ,
3552 is_shared_matlab = is_shared_matlab ,
3653 base_url_prefix = base_url_prefix ,
54+ ** kwargs ,
3755 )
3856
3957
@@ -42,19 +60,34 @@ async def start_matlab_proxy_for_jsp(
4260 is_shared_matlab : bool ,
4361 mpm_auth_token : str ,
4462 base_url_prefix : str = "" ,
63+ ** kwargs ,
4564):
4665 """
4766 Starts a MATLAB proxy server specifically for Jupyter Server Proxy (JSP) - Open MATLAB launcher.
4867
4968 This function is a wrapper around the `start_matlab_proxy` function, providing
5069 a more specific context (mpm_auth_token) for starting the MATLAB proxy server via proxy manager.
70+
71+ Args:
72+ caller_id (str): The identifier for the caller (kernel id).
73+ parent_id (str): The context in which the server is being started (parent pid).
74+ is_shared_matlab (bool): Flag indicating if the MATLAB proxy is shared.
75+ base_url_prefix (str, optional): Custom URL path which gets added to mwi_base_url. Defaults to "".
76+ **kwargs: Additional keyword arguments:
77+ env (Dict[str, str], optional): Dictionary of environment variables to set for the
78+ MATLAB proxy process. These variables can control various aspects of the MATLAB proxy
79+ behavior. Defaults to None.
80+
81+ Returns:
82+ dict: A dictionary representation of the server process, including any errors encountered.
5183 """
5284 return await _start_matlab_proxy (
5385 caller_id = "jsp" ,
5486 ctx = parent_id ,
5587 is_shared_matlab = is_shared_matlab ,
5688 mpm_auth_token = mpm_auth_token ,
5789 base_url_prefix = base_url_prefix ,
90+ ** kwargs ,
5891 )
5992
6093
@@ -123,6 +156,11 @@ async def _start_matlab_proxy(**options) -> dict:
123156 client_id , base_url_prefix
124157 )
125158
159+ # Use client-provided environment variables, if available
160+ client_env_variables = options .get ("env" )
161+ if client_env_variables and isinstance (client_env_variables , dict ):
162+ matlab_proxy_env .update (client_env_variables )
163+
126164 log .debug (
127165 "Starting new matlab proxy server using ctx=%s, client_id=%s, is_shared_matlab=%s" ,
128166 ctx ,
0 commit comments