matlab-proxy 0.24.1__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 +1 -3
- matlab_proxy/app_state.py +56 -21
- matlab_proxy/constants.py +2 -1
- matlab_proxy/gui/index.html +1 -1
- matlab_proxy/gui/static/js/index.qK3VCGVb.js +64 -0
- matlab_proxy/matlab/startup.m +1 -4
- matlab_proxy/settings.py +145 -91
- matlab_proxy/util/mwi/environment_variables.py +2 -27
- matlab_proxy/util/mwi/exceptions.py +14 -1
- matlab_proxy/util/mwi/validators.py +19 -11
- {matlab_proxy-0.24.1.dist-info → matlab_proxy-0.25.0.dist-info}/METADATA +32 -20
- {matlab_proxy-0.24.1.dist-info → matlab_proxy-0.25.0.dist-info}/RECORD +25 -25
- {matlab_proxy-0.24.1.dist-info → matlab_proxy-0.25.0.dist-info}/WHEEL +1 -1
- {matlab_proxy-0.24.1.dist-info → matlab_proxy-0.25.0.dist-info}/entry_points.txt +0 -1
- tests/integration/integration_tests_with_license/test_http_end_points.py +4 -5
- tests/unit/test_app.py +94 -45
- tests/unit/test_app_state.py +37 -9
- tests/unit/test_non_dev_mode.py +4 -4
- tests/unit/test_settings.py +175 -11
- tests/unit/util/mwi/test_token_auth.py +5 -5
- tests/unit/util/mwi/test_validators.py +12 -7
- tests/unit/util/test_mw.py +2 -2
- tests/unit/util/test_util.py +7 -7
- matlab_proxy/gui/static/js/index.Cm14Eqsb.js +0 -64
- {matlab_proxy-0.24.1.dist-info → matlab_proxy-0.25.0.dist-info}/LICENSE.md +0 -0
- {matlab_proxy-0.24.1.dist-info → matlab_proxy-0.25.0.dist-info}/top_level.txt +0 -0
matlab_proxy/matlab/startup.m
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
% Copyright 2020-
|
|
1
|
+
% Copyright 2020-2025 The MathWorks, Inc.
|
|
2
2
|
|
|
3
|
-
if (strlength(getenv('MWI_BASE_URL')) > 0)
|
|
4
|
-
connector.internal.setConfig('contextRoot', getenv('MWI_BASE_URL'));
|
|
5
|
-
end
|
|
6
3
|
evalc('connector.internal.Worker.start');
|
|
7
4
|
|
|
8
5
|
% Add-on explorer is not supported in this environment.
|
matlab_proxy/settings.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright 2020-
|
|
1
|
+
# Copyright 2020-2025 The MathWorks, Inc.
|
|
2
2
|
|
|
3
3
|
import datetime
|
|
4
4
|
import os
|
|
@@ -47,7 +47,7 @@ def get_process_startup_timeout():
|
|
|
47
47
|
return int(custom_startup_timeout)
|
|
48
48
|
|
|
49
49
|
else:
|
|
50
|
-
logger.
|
|
50
|
+
logger.warning(
|
|
51
51
|
f"The value set for {mwi_env.get_env_name_process_startup_timeout()}:{custom_startup_timeout} is not a number. Using {constants.DEFAULT_PROCESS_START_TIMEOUT} as the default value"
|
|
52
52
|
)
|
|
53
53
|
return constants.DEFAULT_PROCESS_START_TIMEOUT
|
|
@@ -74,7 +74,7 @@ def get_matlab_executable_and_root_path():
|
|
|
74
74
|
matlab_root_path = Path(custom_matlab_root_path)
|
|
75
75
|
|
|
76
76
|
# Terminate process if invalid Custom Path was provided!
|
|
77
|
-
mwi.validators.validate_matlab_root_path(
|
|
77
|
+
matlab_root_path = mwi.validators.validate_matlab_root_path(
|
|
78
78
|
matlab_root_path, is_custom_matlab_root=True
|
|
79
79
|
)
|
|
80
80
|
|
|
@@ -101,10 +101,9 @@ def get_matlab_executable_and_root_path():
|
|
|
101
101
|
|
|
102
102
|
# Control only gets here if custom matlab root was not set AND which matlab returned no results.
|
|
103
103
|
# Note, error messages are formatted as multi-line strings and the front end displays them as is.
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
raise MatlabInstallError(error_message)
|
|
104
|
+
raise MatlabInstallError(
|
|
105
|
+
"Unable to find MATLAB on the system PATH. Add MATLAB to the system PATH, and restart matlab-proxy."
|
|
106
|
+
)
|
|
108
107
|
|
|
109
108
|
|
|
110
109
|
def get_matlab_version(matlab_root_path):
|
|
@@ -126,7 +125,16 @@ def get_matlab_version(matlab_root_path):
|
|
|
126
125
|
tree = ET.parse(version_info_file_path)
|
|
127
126
|
root = tree.getroot()
|
|
128
127
|
|
|
129
|
-
|
|
128
|
+
matlab_version = root.find("release").text
|
|
129
|
+
|
|
130
|
+
# If the matlab on system PATH is a wrapper script, then it would not be possible to determine MATLAB root (inturn not being able to determine MATLAB version)
|
|
131
|
+
# unless MWI_CUSTOM_MATLAB_ROOT is set. Raising only a warning as the matlab version is only required for communicating with MHLM.
|
|
132
|
+
if not matlab_version:
|
|
133
|
+
logger.warning(
|
|
134
|
+
f"Could not determine MATLAB version from MATLAB root path: {matlab_root_path}. Set {mwi_env.get_env_name_custom_matlab_root()} to a valid MATLAB root path"
|
|
135
|
+
)
|
|
136
|
+
|
|
137
|
+
return matlab_version
|
|
130
138
|
|
|
131
139
|
|
|
132
140
|
def get_ws_env_settings():
|
|
@@ -210,6 +218,7 @@ def get_dev_settings(config):
|
|
|
210
218
|
),
|
|
211
219
|
"warnings": [],
|
|
212
220
|
"is_xvfb_available": False,
|
|
221
|
+
"is_windowmanager_available": False,
|
|
213
222
|
"mwi_idle_timeout": None,
|
|
214
223
|
}
|
|
215
224
|
|
|
@@ -263,22 +272,23 @@ def get(config_name=matlab_proxy.get_default_config_name(), dev=False):
|
|
|
263
272
|
settings.update(get_server_settings(config_name))
|
|
264
273
|
|
|
265
274
|
settings["is_xvfb_available"] = True if shutil.which("Xvfb") else False
|
|
275
|
+
settings["is_windowmanager_available"] = (
|
|
276
|
+
True if shutil.which("fluxbox") else False
|
|
277
|
+
)
|
|
266
278
|
|
|
267
279
|
# Warn user if xvfb is not available on system path.
|
|
268
|
-
if system.is_linux()
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
# Returning settings that have been created without exceptions
|
|
281
|
-
pass
|
|
280
|
+
if system.is_linux():
|
|
281
|
+
if not settings["is_xvfb_available"]:
|
|
282
|
+
warning = " Unable to find Xvfb on the system PATH. Xvfb enables graphical abilities like plots and figures in the MATLAB desktop.\nConsider adding Xvfb to the system PATH and restart matlab-proxy.\nFor details, see https://github.com/mathworks/matlab-proxy#requirements."
|
|
283
|
+
logger.warning(warning)
|
|
284
|
+
settings["warnings"].append(warning)
|
|
285
|
+
|
|
286
|
+
if not settings["is_windowmanager_available"]:
|
|
287
|
+
warning = " Unable to find fluxbox on the system PATH. To use Simulink Online, add Fluxbox to the system PATH and restart matlab-proxy. For details, see https://github.com/mathworks/matlab-proxy#requirements."
|
|
288
|
+
logger.warning(warning)
|
|
289
|
+
settings["warnings"].append(warning)
|
|
290
|
+
|
|
291
|
+
settings.update(get_matlab_settings())
|
|
282
292
|
|
|
283
293
|
return settings
|
|
284
294
|
|
|
@@ -362,84 +372,33 @@ def get_matlab_settings():
|
|
|
362
372
|
Unless they are of type UIVisibleFatalError
|
|
363
373
|
"""
|
|
364
374
|
|
|
365
|
-
matlab_executable_path, matlab_root_path = get_matlab_executable_and_root_path()
|
|
366
|
-
|
|
367
375
|
ws_env, ws_env_suffix = get_ws_env_settings()
|
|
376
|
+
mw_licensing_urls = _get_mw_licensing_urls(ws_env_suffix)
|
|
377
|
+
nlm_conn_str = _get_nlm_conn_str()
|
|
378
|
+
has_custom_code_to_execute, code_to_execute = _get_matlab_code_to_execute()
|
|
379
|
+
err = None
|
|
368
380
|
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
# other ways of licensing. But existence of license_info.xml in matlab/licenses
|
|
372
|
-
# folder may cause hinderance in this workflow. So specifying -licmode as 'file'
|
|
373
|
-
# overrides license_info.xml and enforces MLM_LICENSE_FILE to be the topmost priority
|
|
374
|
-
|
|
375
|
-
# NLM Connection String provided by MLM_LICENSE_FILE environment variable
|
|
376
|
-
nlm_conn_str = mwi.validators.validate_mlm_license_file(
|
|
377
|
-
os.environ.get(mwi_env.get_env_name_network_license_manager())
|
|
378
|
-
)
|
|
379
|
-
matlab_lic_mode = ["-licmode", "file"] if nlm_conn_str else ""
|
|
380
|
-
# flag to hide MATLAB Window
|
|
381
|
-
flag_to_hide_desktop = ["-nodesktop"]
|
|
382
|
-
if system.is_windows():
|
|
383
|
-
flag_to_hide_desktop.extend(["-noDisplayDesktop", "-wait", "-log"])
|
|
381
|
+
try:
|
|
382
|
+
matlab_executable_path, matlab_root_path = get_matlab_executable_and_root_path()
|
|
384
383
|
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
384
|
+
except UIVisibleFatalError as error:
|
|
385
|
+
logger.error(f"Exception raised during initialization: {error}")
|
|
386
|
+
# Set matlab root and executable path to None as MATLAB root could not be determined
|
|
387
|
+
matlab_executable_path = matlab_root_path = None
|
|
388
|
+
err = error
|
|
388
389
|
|
|
389
390
|
matlab_version = get_matlab_version(matlab_root_path)
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
# unless MWI_CUSTOM_MATLAB_ROOT is set. Raising only a warning as the matlab version is only required for communicating with MHLM.
|
|
393
|
-
if not matlab_version:
|
|
394
|
-
logger.warn(
|
|
395
|
-
f"Could not determine MATLAB version from MATLAB root path: {matlab_root_path}"
|
|
396
|
-
)
|
|
397
|
-
logger.warn(
|
|
398
|
-
f"Set {mwi_env.get_env_name_custom_matlab_root()} to a valid MATLAB root path"
|
|
399
|
-
)
|
|
400
|
-
|
|
401
|
-
mpa_flags = (
|
|
402
|
-
mwi_env.Experimental.get_mpa_flags()
|
|
403
|
-
if mwi_env.Experimental.is_mpa_enabled()
|
|
404
|
-
else ""
|
|
405
|
-
)
|
|
406
|
-
profile_matlab_startup = (
|
|
407
|
-
"-timing" if mwi_env.Experimental.is_matlab_startup_profiling_enabled() else ""
|
|
408
|
-
)
|
|
409
|
-
|
|
410
|
-
has_custom_code_to_execute = (
|
|
411
|
-
len(os.getenv(mwi_env.get_env_name_custom_matlab_code(), "").strip()) > 0
|
|
412
|
-
)
|
|
413
|
-
|
|
414
|
-
# Sanitize file paths to avoid MATLAB not running the script due to early breakup of character array.
|
|
415
|
-
mp_code_to_execute = f"try; run('{_sanitize_file_path_for_matlab(matlab_startup_file)}'); catch MATLABProxyInitializationError; disp(MATLABProxyInitializationError.message); end;"
|
|
416
|
-
custom_code_to_execute = f"try; run('{_sanitize_file_path_for_matlab(matlab_code_file)}'); catch MATLABCustomStartupCodeError; disp(MATLABCustomStartupCodeError.message); end;"
|
|
417
|
-
code_to_execute = (
|
|
418
|
-
mp_code_to_execute + custom_code_to_execute
|
|
419
|
-
if has_custom_code_to_execute
|
|
420
|
-
else mp_code_to_execute
|
|
421
|
-
)
|
|
391
|
+
matlab_version_determined_on_startup = bool(matlab_version)
|
|
392
|
+
matlab_cmd = _get_matlab_cmd(matlab_executable_path, code_to_execute, nlm_conn_str)
|
|
422
393
|
|
|
423
394
|
return {
|
|
424
|
-
"
|
|
395
|
+
"error": err,
|
|
425
396
|
"matlab_version": matlab_version,
|
|
426
|
-
"
|
|
427
|
-
"
|
|
428
|
-
|
|
429
|
-
"-nosplash",
|
|
430
|
-
*flag_to_hide_desktop,
|
|
431
|
-
"-softwareopengl",
|
|
432
|
-
# " v=mvm ",
|
|
433
|
-
*matlab_lic_mode,
|
|
434
|
-
*mpa_flags,
|
|
435
|
-
profile_matlab_startup,
|
|
436
|
-
"-r",
|
|
437
|
-
code_to_execute,
|
|
438
|
-
],
|
|
397
|
+
"matlab_path": matlab_root_path,
|
|
398
|
+
"matlab_version_determined_on_startup": matlab_version_determined_on_startup,
|
|
399
|
+
"matlab_cmd": matlab_cmd,
|
|
439
400
|
"ws_env": ws_env,
|
|
440
|
-
|
|
441
|
-
"mhlm_api_endpoint": f"https://licensing{ws_env_suffix}.mathworks.com/mls/service/v1/entitlement/list",
|
|
442
|
-
"mwa_login": f"https://login{ws_env_suffix}.mathworks.com",
|
|
401
|
+
**mw_licensing_urls,
|
|
443
402
|
"nlm_conn_str": nlm_conn_str,
|
|
444
403
|
"has_custom_code_to_execute": has_custom_code_to_execute,
|
|
445
404
|
}
|
|
@@ -646,3 +605,98 @@ def _sanitize_file_path_for_matlab(filepath: str) -> str:
|
|
|
646
605
|
"""
|
|
647
606
|
filepath_with_single_quotes_escaped = filepath.replace("'", "''")
|
|
648
607
|
return filepath_with_single_quotes_escaped
|
|
608
|
+
|
|
609
|
+
|
|
610
|
+
def _get_matlab_code_to_execute():
|
|
611
|
+
"""Returns the code that needs to run on MATLAB startup.
|
|
612
|
+
Will check for user provided custom MATLAB code and execute it along with the default startup script.
|
|
613
|
+
|
|
614
|
+
Returns:
|
|
615
|
+
tuple: With the first value representing whether there is custom MATLAB code to execute, and the second value representing the MATLAB code to execute.
|
|
616
|
+
"""
|
|
617
|
+
matlab_code_dir = Path(__file__).resolve().parent / "matlab"
|
|
618
|
+
matlab_startup_file = str(matlab_code_dir / "startup.m")
|
|
619
|
+
matlab_code_file = str(matlab_code_dir / "evaluateUserMatlabCode.m")
|
|
620
|
+
|
|
621
|
+
has_custom_code_to_execute = (
|
|
622
|
+
len(os.getenv(mwi_env.get_env_name_custom_matlab_code(), "").strip()) > 0
|
|
623
|
+
)
|
|
624
|
+
|
|
625
|
+
# Sanitize file paths to avoid MATLAB not running the script due to early breakup of character array.
|
|
626
|
+
mp_code_to_execute = f"try; run('{_sanitize_file_path_for_matlab(matlab_startup_file)}'); catch MATLABProxyInitializationError; disp(MATLABProxyInitializationError.message); end;"
|
|
627
|
+
custom_code_to_execute = f"try; run('{_sanitize_file_path_for_matlab(matlab_code_file)}'); catch MATLABCustomStartupCodeError; disp(MATLABCustomStartupCodeError.message); end;"
|
|
628
|
+
code_to_execute = (
|
|
629
|
+
mp_code_to_execute + custom_code_to_execute
|
|
630
|
+
if has_custom_code_to_execute
|
|
631
|
+
else mp_code_to_execute
|
|
632
|
+
)
|
|
633
|
+
|
|
634
|
+
return has_custom_code_to_execute, code_to_execute
|
|
635
|
+
|
|
636
|
+
|
|
637
|
+
def _get_nlm_conn_str():
|
|
638
|
+
"""Get the Network License Manager (NLM) connection string.
|
|
639
|
+
|
|
640
|
+
Returns:
|
|
641
|
+
str: The NLM connection string provided by the MLM_LICENSE_FILE environment variable.
|
|
642
|
+
"""
|
|
643
|
+
# NLM Connection String provided by MLM_LICENSE_FILE environment variable
|
|
644
|
+
nlm_conn_str = mwi.validators.validate_mlm_license_file(
|
|
645
|
+
os.environ.get(mwi_env.get_env_name_network_license_manager())
|
|
646
|
+
)
|
|
647
|
+
|
|
648
|
+
return nlm_conn_str
|
|
649
|
+
|
|
650
|
+
|
|
651
|
+
def _get_mw_licensing_urls(ws_env_suffix):
|
|
652
|
+
"""Get the MathWorks licensing URLs.
|
|
653
|
+
|
|
654
|
+
Args:
|
|
655
|
+
ws_env_suffix (str): The environment suffix for the licensing URLs.
|
|
656
|
+
|
|
657
|
+
Returns:
|
|
658
|
+
dict: A dictionary containing the MathWorks licensing URLs for authentication and entitlement.
|
|
659
|
+
"""
|
|
660
|
+
return {
|
|
661
|
+
"mwa_api_endpoint": f"https://login{ws_env_suffix}.mathworks.com/authenticationws/service/v4",
|
|
662
|
+
"mhlm_api_endpoint": f"https://licensing{ws_env_suffix}.mathworks.com/mls/service/v1/entitlement/list",
|
|
663
|
+
"mwa_login": f"https://login{ws_env_suffix}.mathworks.com",
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
|
|
667
|
+
def _get_matlab_cmd(matlab_executable_path, code_to_execute, nlm_conn_str):
|
|
668
|
+
"""Construct the MATLAB command with appropriate flags and arguments.
|
|
669
|
+
|
|
670
|
+
Args:
|
|
671
|
+
matlab_executable_path (str): The path to the MATLAB executable.
|
|
672
|
+
code_to_execute (str): The MATLAB code to execute on startup.
|
|
673
|
+
nlm_conn_str (str): The Network License Manager connection string.
|
|
674
|
+
|
|
675
|
+
Returns:
|
|
676
|
+
list: A list of command-line arguments to launch MATLAB with the specified configuration.
|
|
677
|
+
"""
|
|
678
|
+
if not matlab_executable_path:
|
|
679
|
+
return None
|
|
680
|
+
|
|
681
|
+
matlab_lic_mode = ["-licmode", "file"] if nlm_conn_str else ""
|
|
682
|
+
# flag to hide MATLAB Window
|
|
683
|
+
flag_to_hide_desktop = ["-nodesktop"]
|
|
684
|
+
if system.is_windows():
|
|
685
|
+
flag_to_hide_desktop.extend(["-noDisplayDesktop", "-wait", "-log"])
|
|
686
|
+
|
|
687
|
+
profile_matlab_startup = (
|
|
688
|
+
"-timing" if mwi_env.Experimental.is_matlab_startup_profiling_enabled() else ""
|
|
689
|
+
)
|
|
690
|
+
|
|
691
|
+
return [
|
|
692
|
+
matlab_executable_path,
|
|
693
|
+
"-nosplash",
|
|
694
|
+
*flag_to_hide_desktop,
|
|
695
|
+
"-softwareopengl",
|
|
696
|
+
# " v=mvm ",
|
|
697
|
+
*matlab_lic_mode,
|
|
698
|
+
"-externalUI",
|
|
699
|
+
profile_matlab_startup,
|
|
700
|
+
"-r",
|
|
701
|
+
code_to_execute,
|
|
702
|
+
]
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright 2020-
|
|
1
|
+
# Copyright 2020-2025 The MathWorks, Inc.
|
|
2
2
|
"""This file lists and exposes the environment variables which are used by the integration."""
|
|
3
3
|
|
|
4
4
|
import os
|
|
@@ -189,26 +189,6 @@ class Experimental:
|
|
|
189
189
|
"""Returns true if the simulink online is enabled."""
|
|
190
190
|
return _is_env_set_to_true(Experimental.get_env_name_enable_simulink())
|
|
191
191
|
|
|
192
|
-
@staticmethod
|
|
193
|
-
def should_use_mos_html():
|
|
194
|
-
"""Returns true if matlab-proxy should use MOS htmls to load MATLAB"""
|
|
195
|
-
return _is_env_set_to_true("MWI_USE_MOS")
|
|
196
|
-
|
|
197
|
-
@staticmethod
|
|
198
|
-
def should_use_mre_html():
|
|
199
|
-
"""Returns true if matlab-proxy should provide MRE parameter to the htmls used to load MATLAB"""
|
|
200
|
-
return _is_env_set_to_true("MWI_USE_MRE")
|
|
201
|
-
|
|
202
|
-
@staticmethod
|
|
203
|
-
def get_env_name_enable_mpa():
|
|
204
|
-
"""Returns the environment variable name used to enable MPA support"""
|
|
205
|
-
return "MWI_ENABLE_MPA"
|
|
206
|
-
|
|
207
|
-
@staticmethod
|
|
208
|
-
def is_mpa_enabled():
|
|
209
|
-
"""Returns true if the simulink online is enabled."""
|
|
210
|
-
return _is_env_set_to_true(Experimental.get_env_name_enable_mpa())
|
|
211
|
-
|
|
212
192
|
@staticmethod
|
|
213
193
|
def get_env_name_profile_matlab_startup():
|
|
214
194
|
"""Returns the environment variable name used to enable MPA support"""
|
|
@@ -216,10 +196,5 @@ class Experimental:
|
|
|
216
196
|
|
|
217
197
|
@staticmethod
|
|
218
198
|
def is_matlab_startup_profiling_enabled():
|
|
219
|
-
"""Returns true if the
|
|
199
|
+
"""Returns true if the startup profiling is enabled."""
|
|
220
200
|
return _is_env_set_to_true(Experimental.get_env_name_profile_matlab_startup())
|
|
221
|
-
|
|
222
|
-
@staticmethod
|
|
223
|
-
def get_mpa_flags():
|
|
224
|
-
"""Returns list of flags required to enable MPA"""
|
|
225
|
-
return ["-webui", "-externalUI"]
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright 2020-
|
|
1
|
+
# Copyright 2020-2025 The MathWorks, Inc.
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
class AppError(Exception):
|
|
@@ -139,6 +139,19 @@ class XvfbError(AppError):
|
|
|
139
139
|
pass
|
|
140
140
|
|
|
141
141
|
|
|
142
|
+
class WindowManagerError(AppError):
|
|
143
|
+
"""A Class which inherits the AppError class.
|
|
144
|
+
|
|
145
|
+
This class represents any errors raised when instantiating a Window Manager within the Xvfb DISPLAY.
|
|
146
|
+
|
|
147
|
+
Args:
|
|
148
|
+
AppError (Class): Parent Class containing attributes to store
|
|
149
|
+
messages, logs and stacktrace.
|
|
150
|
+
"""
|
|
151
|
+
|
|
152
|
+
pass
|
|
153
|
+
|
|
154
|
+
|
|
142
155
|
class EmbeddedConnectorError(MatlabError):
|
|
143
156
|
"""A Class which inherits the MatlabError class.
|
|
144
157
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright 2020-
|
|
1
|
+
# Copyright 2020-2025 The MathWorks, Inc.
|
|
2
2
|
"""This file contains validators for various runtime artifacts.
|
|
3
3
|
A validator is defined as a function which verifies the input and
|
|
4
4
|
returns it unchanged if validation passes.
|
|
@@ -320,9 +320,10 @@ def validate_matlab_root_path(matlab_root: Path, is_custom_matlab_root: bool):
|
|
|
320
320
|
Raises:
|
|
321
321
|
MatlabInstallError
|
|
322
322
|
"""
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
323
|
+
|
|
324
|
+
# When Custom MATLAB root is provided, validate the existence of the
|
|
325
|
+
# VersionInfo.xml file at the specified path else, its optional (for matlab wrapper usecase)
|
|
326
|
+
custom_matlab_root_warn_str = f"Edit the environment variable {mwi_env.get_env_name_custom_matlab_root()} to the correct path, and restart matlab-proxy. "
|
|
326
327
|
|
|
327
328
|
try:
|
|
328
329
|
__validate_if_paths_exist([matlab_root])
|
|
@@ -332,18 +333,25 @@ def validate_matlab_root_path(matlab_root: Path, is_custom_matlab_root: bool):
|
|
|
332
333
|
|
|
333
334
|
except OSError as exc:
|
|
334
335
|
logger.error(". ".join(exc.args))
|
|
335
|
-
raise MatlabInstallError(
|
|
336
|
+
raise MatlabInstallError(
|
|
337
|
+
custom_matlab_root_warn_str if is_custom_matlab_root else ""
|
|
338
|
+
)
|
|
336
339
|
|
|
337
340
|
version_info_file_path = matlab_root / VERSION_INFO_FILE_NAME
|
|
338
341
|
|
|
339
342
|
if not version_info_file_path.is_file():
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
343
|
+
warn_str = f"Unable to locate {VERSION_INFO_FILE_NAME} at {matlab_root}"
|
|
344
|
+
# If VersionInfo.xml file is missing when a custom MATLAB root is provided, then
|
|
345
|
+
# raise an error with a detailed message
|
|
346
|
+
if is_custom_matlab_root:
|
|
347
|
+
log_error_string = custom_matlab_root_warn_str + warn_str
|
|
348
|
+
raise MatlabInstallError(log_error_string)
|
|
344
349
|
|
|
345
|
-
|
|
346
|
-
|
|
350
|
+
else:
|
|
351
|
+
# No VersionInfo.xml file is present and its not a custom MATLAB root, implies a matlab wrapper is
|
|
352
|
+
# being used, so warn the user and return None as MATLAB root could not be determined
|
|
353
|
+
logger.warning(warn_str)
|
|
354
|
+
return None
|
|
347
355
|
|
|
348
356
|
return matlab_root
|
|
349
357
|
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: matlab-proxy
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.25.0
|
|
4
4
|
Summary: Python® package enables you to launch MATLAB® and access it from a web browser.
|
|
5
5
|
Home-page: https://github.com/mathworks/matlab-proxy/
|
|
6
6
|
Author: The MathWorks, Inc.
|
|
7
7
|
Author-email: cloud@mathworks.com
|
|
8
8
|
License: MATHWORKS CLOUD REFERENCE ARCHITECTURE LICENSE
|
|
9
9
|
Keywords: Proxy,MATLAB Proxy,MATLAB,MATLAB Javascript Desktop,MATLAB Web Desktop,Remote MATLAB Web Access
|
|
10
|
-
Platform: UNKNOWN
|
|
11
10
|
Classifier: Intended Audience :: Developers
|
|
12
11
|
Classifier: Natural Language :: English
|
|
13
12
|
Classifier: Programming Language :: Python
|
|
@@ -17,12 +16,14 @@ Classifier: Programming Language :: Python :: 3.10
|
|
|
17
16
|
Classifier: Programming Language :: Python :: 3.11
|
|
18
17
|
Requires-Python: ~=3.8
|
|
19
18
|
Description-Content-Type: text/markdown
|
|
20
|
-
|
|
19
|
+
License-File: LICENSE.md
|
|
20
|
+
Requires-Dist: aiohttp>=3.7.4
|
|
21
21
|
Requires-Dist: aiohttp-session[secure]
|
|
22
22
|
Requires-Dist: importlib-metadata
|
|
23
23
|
Requires-Dist: importlib-resources
|
|
24
24
|
Requires-Dist: psutil
|
|
25
25
|
Requires-Dist: watchdog
|
|
26
|
+
Requires-Dist: requests
|
|
26
27
|
Provides-Extra: dev
|
|
27
28
|
Requires-Dist: aiohttp-devtools; extra == "dev"
|
|
28
29
|
Requires-Dist: black; extra == "dev"
|
|
@@ -34,7 +35,6 @@ Requires-Dist: pytest-mock; extra == "dev"
|
|
|
34
35
|
Requires-Dist: pytest-aiohttp; extra == "dev"
|
|
35
36
|
Requires-Dist: psutil; extra == "dev"
|
|
36
37
|
Requires-Dist: urllib3; extra == "dev"
|
|
37
|
-
Requires-Dist: requests; extra == "dev"
|
|
38
38
|
Requires-Dist: pytest-playwright; extra == "dev"
|
|
39
39
|
|
|
40
40
|
# MATLAB Proxy
|
|
@@ -42,11 +42,11 @@ Requires-Dist: pytest-playwright; extra == "dev"
|
|
|
42
42
|
|
|
43
43
|
----
|
|
44
44
|
|
|
45
|
-
|
|
45
|
+
Use this Python® package `matlab-proxy` to start MATLAB® and access it from a web browser.
|
|
46
46
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
47
|
+
Install this package to create an executable `matlab-proxy-app`, which starts MATLAB and provides you a URL to access it.
|
|
48
|
+
|
|
49
|
+
MATLAB Proxy is under active development. For support or to report issues, see [Feedback](#feedback).
|
|
50
50
|
|
|
51
51
|
----
|
|
52
52
|
|
|
@@ -62,17 +62,19 @@ The MATLAB Proxy is under active development. For support or to report issues, s
|
|
|
62
62
|
- [Feedback](#feedback)
|
|
63
63
|
|
|
64
64
|
## Requirements
|
|
65
|
-
* MATLAB® R2020b or later
|
|
65
|
+
* MATLAB® R2020b or later, installed and added to the system PATH.
|
|
66
66
|
```bash
|
|
67
67
|
# Confirm MATLAB is on the PATH
|
|
68
68
|
which matlab
|
|
69
69
|
```
|
|
70
70
|
* The dependencies required to run MATLAB.
|
|
71
|
-
|
|
71
|
+
For details, refer to the Dockerfiles in the [matlab-deps](https://github.com/mathworks-ref-arch/container-images/tree/master/matlab-deps) repository for your desired version of MATLAB.
|
|
72
|
+
|
|
73
|
+
* X Virtual Frame Buffer (Xvfb) (only for Linux® based systems):
|
|
72
74
|
|
|
73
|
-
|
|
75
|
+
Installing Xvfb is optional (starting v0.11.0 of matlab-proxy) but highly recommended. Xvfb enables graphical abilities like plots and figures in the MATLAB desktop.
|
|
76
|
+
To install Xvfb on your Linux machine, use:
|
|
74
77
|
|
|
75
|
-
Install it on your linux machine using:
|
|
76
78
|
```bash
|
|
77
79
|
# On a Debian/Ubuntu based system:
|
|
78
80
|
$ sudo apt install xvfb
|
|
@@ -84,8 +86,18 @@ The MATLAB Proxy is under active development. For support or to report issues, s
|
|
|
84
86
|
|
|
85
87
|
$ sudo yum install xorg-x11-server-Xvfb
|
|
86
88
|
```
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
* Fluxbox Window Manager (only for Linux® based systems):
|
|
92
|
+
|
|
93
|
+
Installing fluxbox is optional but required to use Simulink Online.
|
|
94
|
+
|
|
95
|
+
Install fluxbox using:
|
|
96
|
+
```bash
|
|
97
|
+
# On a Debian/Ubuntu based system:
|
|
98
|
+
$ sudo apt install fluxbox
|
|
99
|
+
```
|
|
87
100
|
|
|
88
|
-
*Note: The installation of Xvfb is **optional** (w.e.f. v0.11.0 of matlab-proxy). However, we highly recommend installing it.*
|
|
89
101
|
* Python versions: **3.8** | **3.9** | **3.10** | **3.11**
|
|
90
102
|
* [Browser Requirements](https://www.mathworks.com/support/requirements/browser-requirements.html)
|
|
91
103
|
* Supported Operating Systems:
|
|
@@ -103,7 +115,7 @@ python -m pip install matlab-proxy
|
|
|
103
115
|
```
|
|
104
116
|
|
|
105
117
|
### Building From Sources
|
|
106
|
-
Building from sources requires Node.js® version
|
|
118
|
+
Building from sources requires Node.js® version 18 or higher. [Click here to install Node.js](https://nodejs.org/en/)
|
|
107
119
|
|
|
108
120
|
```bash
|
|
109
121
|
git clone https://github.com/mathworks/matlab-proxy.git
|
|
@@ -123,7 +135,7 @@ which matlab-proxy-app
|
|
|
123
135
|
|
|
124
136
|
Once the `matlab-proxy` package is installed.
|
|
125
137
|
|
|
126
|
-
* Open a
|
|
138
|
+
* Open a terminal and start `matlab-proxy-app`. On Linux, the command would be
|
|
127
139
|
```bash
|
|
128
140
|
env MWI_BASE_URL="/matlab" matlab-proxy-app
|
|
129
141
|
```
|
|
@@ -170,7 +182,7 @@ The following options are available in the status panel (some options are only a
|
|
|
170
182
|
|
|
171
183
|
## Examples
|
|
172
184
|
* For installing/usage in a Docker container, see this [Dockerfile](./examples/Dockerfile) and its [README](./examples/README.md).
|
|
173
|
-
* For upgrading **matlab-proxy** in an existing Docker image, see this [Dockerfile.upgrade.matlab-proxy](./examples/Dockerfile.upgrade.matlab-proxy) and its [README](./examples/README.md#upgrading-matlab-proxy-package-in-a-docker-image)
|
|
185
|
+
* For upgrading **matlab-proxy** in an existing Docker image, see this [Dockerfile.upgrade.matlab-proxy](./examples/Dockerfile.upgrade.matlab-proxy) and its [README](./examples/README.md#upgrading-matlab-proxy-package-in-a-docker-image).
|
|
174
186
|
* For usage in a Jupyter environment, see [jupyter-matlab-proxy](https://github.com/mathworks/jupyter-matlab-proxy).
|
|
175
187
|
|
|
176
188
|
## Platform Support
|
|
@@ -208,8 +220,10 @@ To install `matlab-proxy` in WSL 2, follow the steps mentioned in the [Installat
|
|
|
208
220
|
`matlab-proxy` version `v0.7.0` introduces support for using an existing MATLAB license. Use the Existing License option only if you have an activated MATLAB. This allows you to start MATLAB without authenticating every time.
|
|
209
221
|
|
|
210
222
|
## Limitations
|
|
211
|
-
This package supports the same
|
|
212
|
-
[
|
|
223
|
+
This package supports the same set of MATLAB features and commands as MATLAB® Online. For the full list, see
|
|
224
|
+
[Specifications and Limitations for MATLAB Online](https://www.mathworks.com/products/matlab-online/limitations.html).
|
|
225
|
+
|
|
226
|
+
Simulink Online is supported exclusively on Linux platforms starting from MATLAB R2024b.
|
|
213
227
|
|
|
214
228
|
## Security
|
|
215
229
|
We take your security concerns seriously, and will attempt to address all concerns.
|
|
@@ -229,5 +243,3 @@ If you encounter a technical issue or have an enhancement request, create an iss
|
|
|
229
243
|
Copyright 2020-2025 The MathWorks, Inc.
|
|
230
244
|
|
|
231
245
|
---
|
|
232
|
-
|
|
233
|
-
|