matlab-proxy 0.24.2__py3-none-any.whl → 0.25.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of matlab-proxy might be problematic. Click here for more details.

matlab_proxy/app.py CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright 2020-2024 The MathWorks, Inc.
1
+ # Copyright 2020-2025 The MathWorks, Inc.
2
2
 
3
3
  import asyncio
4
4
  import json
@@ -197,8 +197,6 @@ async def get_env_config(req):
197
197
  state = req.app["state"]
198
198
  config = state.settings["env_config"]
199
199
 
200
- config["useMOS"] = mwi_env.Experimental.should_use_mos_html()
201
- config["useMRE"] = mwi_env.Experimental.should_use_mre_html()
202
200
  config["isConcurrencyEnabled"] = IS_CONCURRENCY_CHECK_ENABLED
203
201
  # In a previously authenticated session, if the url is accessed without the token(using session cookie), send the token as well.
204
202
  config["authentication"] = {
matlab_proxy/app_state.py CHANGED
@@ -34,6 +34,7 @@ from matlab_proxy.util.mwi.exceptions import (
34
34
  OnlineLicensingError,
35
35
  UIVisibleFatalError,
36
36
  XvfbError,
37
+ WindowManagerError,
37
38
  log_error,
38
39
  )
39
40
 
@@ -548,7 +549,7 @@ class AppState:
548
549
 
549
550
  if system.is_linux():
550
551
  # If Xvfb is on system PATH, check if it up and running.
551
- if self.settings["is_xvfb_available"] and (
552
+ if self.settings.get("is_xvfb_available", None) and (
552
553
  xvfb_process is None or xvfb_process.returncode is not None
553
554
  ):
554
555
  logger.debug(
@@ -994,17 +995,11 @@ class AppState:
994
995
  # The mwi_logs_dir is where MATLAB will write any subsequent logs
995
996
  matlab_env["MATLAB_LOG_DIR"] = str(self.mwi_logs_dir)
996
997
 
997
- # Set MW_CONNECTOR_CONTEXT_ROOT for MPA
998
- if mwi_env.Experimental.is_mpa_enabled():
999
- matlab_env["MW_CONNECTOR_CONTEXT_ROOT"] = self.settings.get("base_url", "/")
1000
- logger.info(
1001
- f"MW_CONNECTOR_CONTEXT_ROOT is set to: {matlab_env['MW_CONNECTOR_CONTEXT_ROOT']}"
1002
- )
1003
-
1004
- # Setup Simulink Online which requires a pre-warm stage
1005
- if mwi_env.Experimental.is_simulink_enabled():
1006
- logger.info("Enabling usage of Simulink Online...")
1007
- matlab_env["PREWARM_SIMULINK"] = "true"
998
+ # Set MW_CONNECTOR_CONTEXT_ROOT
999
+ matlab_env["MW_CONNECTOR_CONTEXT_ROOT"] = self.settings.get("base_url", "/")
1000
+ logger.info(
1001
+ f"MW_CONNECTOR_CONTEXT_ROOT is set to: {matlab_env['MW_CONNECTOR_CONTEXT_ROOT']}"
1002
+ )
1008
1003
 
1009
1004
  # Env setup related to logging
1010
1005
  # Very verbose logging in debug mode
@@ -1053,6 +1048,31 @@ class AppState:
1053
1048
  key: value for key, value in env_vars.items() if not key.startswith(prefix)
1054
1049
  }
1055
1050
 
1051
+ async def __start_window_manager(self, display=None):
1052
+ if display is None:
1053
+ logger.info("Not starting fluxbox as display is not provided")
1054
+ return None
1055
+
1056
+ wm_env = os.environ.copy()
1057
+ wm_env["DISPLAY"] = display
1058
+ wm_cmd = ["fluxbox", "-screen", "0", "-log", "/dev/null"]
1059
+
1060
+ try:
1061
+ logger.info(f"Starting window manager with DISPLAY={wm_env['DISPLAY']}")
1062
+ return await asyncio.create_subprocess_exec(
1063
+ *wm_cmd, close_fds=False, env=wm_env, stderr=asyncio.subprocess.PIPE
1064
+ )
1065
+
1066
+ except Exception as err:
1067
+ self.error = WindowManagerError(
1068
+ "Unable to start the Fluxbox Window Manager due to the following error: "
1069
+ + err
1070
+ )
1071
+ # Log the error on the console.
1072
+ log_error(logger, self.error)
1073
+
1074
+ return None
1075
+
1056
1076
  async def __start_xvfb_process(self):
1057
1077
  """Private method to start the xvfb process. Will set appropriate
1058
1078
  errors to self.error and return None when any exceptions are raised.
@@ -1074,7 +1094,7 @@ class AppState:
1074
1094
  )
1075
1095
  self.settings["matlab_display"] = ":" + str(display_port)
1076
1096
 
1077
- logger.debug(f"Started Xvfb with PID={xvfb.pid} on DISPLAY={display_port}")
1097
+ logger.info(f"Started Xvfb with PID={xvfb.pid} on DISPLAY={display_port}")
1078
1098
 
1079
1099
  return xvfb
1080
1100
 
@@ -1304,7 +1324,13 @@ class AppState:
1304
1324
 
1305
1325
  self.processes["xvfb"] = xvfb
1306
1326
 
1327
+ # Start Window Manager on linux if possible
1328
+ if system.is_linux() and self.settings["is_windowmanager_available"]:
1329
+ display = self.settings.get("matlab_display", None)
1330
+ await self.__start_window_manager(display)
1331
+
1307
1332
  try:
1333
+
1308
1334
  # Prepare ready file for the MATLAB process.
1309
1335
  self.create_logs_dir_for_MATLAB()
1310
1336
 
matlab_proxy/constants.py CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright 2023-2024 The MathWorks, Inc.
1
+ # Copyright 2023-2025 The MathWorks, Inc.
2
2
  from typing import Final, List
3
3
 
4
4
  """This module defines project-level constants"""
@@ -24,6 +24,7 @@ SUPPORTED_MATLAB_VERSIONS: Final[List[str]] = [
24
24
  "R2023b",
25
25
  "R2024a",
26
26
  "R2024b",
27
+ "R2025a",
27
28
  ]
28
29
 
29
30
  # This constant when set to True restricts the number of active sessions to one
@@ -11,7 +11,7 @@
11
11
  <meta name="internal_mw_identifier" content="MWI_MATLAB_PROXY_IDENTIFIER" />
12
12
  <link rel="manifest" href="./manifest.json" />
13
13
  <title>MATLAB</title>
14
- <script type="module" crossorigin src="./static/js/index.c3NLxnRM.js"></script>
14
+ <script type="module" crossorigin src="./static/js/index.qK3VCGVb.js"></script>
15
15
  <link rel="stylesheet" crossorigin href="./static/css/index.BSVLACuY.css">
16
16
  </head>
17
17
  <body>