matlab-proxy 0.12.1__py3-none-any.whl → 0.14.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
@@ -546,7 +546,9 @@ async def matlab_view(req):
546
546
  await ws_server.prepare(req)
547
547
 
548
548
  async with aiohttp.ClientSession(
549
- cookies=req.cookies, connector=aiohttp.TCPConnector(verify_ssl=False)
549
+ trust_env=True,
550
+ cookies=req.cookies,
551
+ connector=aiohttp.TCPConnector(verify_ssl=False),
550
552
  ) as client_session:
551
553
  try:
552
554
  async with client_session.ws_connect(
@@ -610,6 +612,7 @@ async def matlab_view(req):
610
612
  else:
611
613
  # Proxy, injecting request header
612
614
  async with aiohttp.ClientSession(
615
+ trust_env=True,
613
616
  connector=aiohttp.TCPConnector(verify_ssl=False),
614
617
  ) as client_session:
615
618
  try:
@@ -846,15 +849,31 @@ def create_app(config_name=matlab_proxy.get_default_config_name()):
846
849
  return app
847
850
 
848
851
 
849
- def main():
850
- """Starting point of the integration. Creates the web app and runs indefinitely."""
852
+ def configure_no_proxy_in_env():
853
+ """Update the environment variable no_proxy to allow communication between processes on the local machine."""
854
+ import os
851
855
 
852
- # The integration needs to be called with --config flag.
853
- # Parse the passed cli arguments.
854
- desired_configuration_name = util.parse_cli_args()["config"]
856
+ no_proxy_whitelist = ["0.0.0.0", "localhost", "127.0.0.1"]
857
+
858
+ no_proxy_env = os.environ.get("no_proxy")
859
+ if no_proxy_env is None:
860
+ os.environ["no_proxy"] = ",".join(no_proxy_whitelist)
861
+ else:
862
+ # Create set with leading and trailing whitespaces stripped
863
+ existing_no_proxy_env = [
864
+ val.lstrip().rstrip() for val in no_proxy_env.split(",")
865
+ ]
866
+ os.environ["no_proxy"] = ",".join(
867
+ set(existing_no_proxy_env + no_proxy_whitelist)
868
+ )
869
+ logger.info(f"Setting no_proxy to: {os.environ.get('no_proxy')}")
870
+
871
+
872
+ def create_and_start_app(config_name):
873
+ configure_no_proxy_in_env()
855
874
 
856
875
  # Create, configure and start the app.
857
- app = create_app(config_name=desired_configuration_name)
876
+ app = create_app(config_name)
858
877
  app = configure_and_start(app)
859
878
 
860
879
  loop = util.get_event_loop()
@@ -884,3 +903,25 @@ def main():
884
903
  logger.info("Finished shutting down. Thank you for using the MATLAB proxy.")
885
904
  loop.close()
886
905
  sys.exit(0)
906
+
907
+
908
+ def print_version_and_exit():
909
+ """prints the version of the package and exits"""
910
+ from importlib.metadata import version
911
+
912
+ matlab_proxy_version = version(__name__.split(".")[0])
913
+ print(f"{matlab_proxy_version}")
914
+ sys.exit(0)
915
+
916
+
917
+ def main():
918
+ """Starting point of the integration. Creates the web app and runs indefinitely."""
919
+
920
+ if util.parse_cli_args()["version"]:
921
+ print_version_and_exit()
922
+
923
+ # The integration needs to be called with --config flag.
924
+ # Parse the passed cli arguments.
925
+ desired_configuration_name = util.parse_cli_args()["config"]
926
+
927
+ create_and_start_app(config_name=desired_configuration_name)
matlab_proxy/app_state.py CHANGED
@@ -606,7 +606,7 @@ class AppState:
606
606
  util.prettify(
607
607
  boundary_filler="=",
608
608
  text_arr=[
609
- f"MATLAB can be accessed at:",
609
+ f"Access MATLAB at:",
610
610
  self.settings["mwi_server_url"].replace("0.0.0.0", "localhost")
611
611
  + mwi_auth_token_str,
612
612
  ],
@@ -735,9 +735,9 @@ class AppState:
735
735
  logger.info(
736
736
  f"Writing MATLAB process logs to: {matlab_env['MW_DIAGNOSTIC_DEST']}"
737
737
  )
738
- matlab_env[
739
- "MW_DIAGNOSTIC_SPEC"
740
- ] = "connector::http::server=all;connector::lifecycle=all"
738
+ matlab_env["MW_DIAGNOSTIC_SPEC"] = (
739
+ "connector::http::server=all;connector::lifecycle=all"
740
+ )
741
741
 
742
742
  # TODO Introduce a warmup flag to enable this?
743
743
  # matlab_env["CONNECTOR_CONFIGURABLE_WARMUP_TASKS"] = "warmup_hgweb"
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "files": {
3
3
  "main.css": "./static/css/main.47712126.css",
4
- "main.js": "./static/js/main.b7862305.js",
4
+ "main.js": "./static/js/main.14aa7840.js",
5
5
  "static/media/mathworks-pictograms.svg?20181009": "./static/media/mathworks-pictograms.f6f087b008b5a9435f26.svg",
6
6
  "static/media/MATLAB-env-blur.png": "./static/media/MATLAB-env-blur.4fc94edbc82d3184e5cb.png",
7
7
  "static/media/mathworks.svg?20181004": "./static/media/mathworks.80a3218e1ba29f0573fb.svg",
@@ -35,10 +35,10 @@
35
35
  "static/media/gripper.svg": "./static/media/gripper.9defbc5e76d0de8bb6e0.svg",
36
36
  "static/media/arrow.svg": "./static/media/arrow.0c2968b90bd9a64c8c3f.svg",
37
37
  "main.47712126.css.map": "./static/css/main.47712126.css.map",
38
- "main.b7862305.js.map": "./static/js/main.b7862305.js.map"
38
+ "main.14aa7840.js.map": "./static/js/main.14aa7840.js.map"
39
39
  },
40
40
  "entrypoints": [
41
41
  "static/css/main.47712126.css",
42
- "static/js/main.b7862305.js"
42
+ "static/js/main.14aa7840.js"
43
43
  ]
44
44
  }
@@ -1 +1 @@
1
- <!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="./favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="MATLAB"/><meta name="internal_mw_identifier" content="MWI_MATLAB_PROXY_IDENTIFIER"/><link rel="manifest" href="./manifest.json"/><title>MATLAB</title><script defer="defer" src="./static/js/main.b7862305.js"></script><link href="./static/css/main.47712126.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
1
+ <!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="./favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="MATLAB"/><meta name="internal_mw_identifier" content="MWI_MATLAB_PROXY_IDENTIFIER"/><link rel="manifest" href="./manifest.json"/><title>MATLAB</title><script defer="defer" src="./static/js/main.14aa7840.js"></script><link href="./static/css/main.47712126.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>