|
| 1 | +# MATLAB Proxy Manager |
| 2 | + |
| 3 | +---- |
| 4 | +This README is intended for MathWorks® developers only. |
| 5 | +`matlab-proxy-manager` is part of the `matlab-proxy` package and it helps in managing the lifecycle and proxying of MATLAB proxy processes. |
| 6 | + |
| 7 | +It provides a seamless integration with Jupyter environments, allowing MATLAB to be accessed and controlled via a proxy. |
| 8 | + |
| 9 | +Upon installation, this package introduces an executable `matlab-proxy-manager-app`, which is utilized by the Jupyter Server Proxy to initiate `matlab-proxy-manager`. |
| 10 | + |
| 11 | +---- |
| 12 | + |
| 13 | +**Table of Contents** |
| 14 | +- [Project Structure](#structure) |
| 15 | +- [Installation](#installation) |
| 16 | + - [PyPI](#pypi) |
| 17 | + - [Building From Sources](#building-from-sources) |
| 18 | +- [Usage](#usage) |
| 19 | +- [Security](#security) |
| 20 | + |
| 21 | +## Structure |
| 22 | +`matlab-proxy-manager` is organized into several key sub-folders: |
| 23 | + |
| 24 | +1. lib: |
| 25 | + |
| 26 | + * This directory contains the library APIs that facilitate the invocation of MATLAB proxy processes. It supports API calls, enabling the MATLAB Kernel to manage proxy instances effectively. For detailed information, refer to the README within the lib folder. |
| 27 | + |
| 28 | +2. storage: |
| 29 | + * The file system serves as the source of truth for `matlab-proxy-manager`, storing metadata about each MATLAB proxy server in dedicated files. A new file is generated whenever a proxy instance is launched and is removed upon termination of the instance or deletion of the Kernel that initiated it. |
| 30 | + |
| 31 | +3. web: |
| 32 | + * This component handles proxy workflows through HTTP/WebSocket requests, which are part of the executable process spawned by clients using the `matlab-proxy-manager-app`. For specific requirements and constraints, consult the README located in the web folder. |
| 33 | + |
| 34 | +4. utils: |
| 35 | + * A collection of helper functions utilized across various parts of the project, ensuring modularity and code reuse. |
| 36 | + |
| 37 | +## Installation |
| 38 | + |
| 39 | +### PyPI |
| 40 | +`matlab-proxy-manager` is included in the `matlab-proxy` repository and can be easily installed from the Python Package Index: |
| 41 | + |
| 42 | +```bash |
| 43 | +python -m pip install matlab-proxy |
| 44 | +``` |
| 45 | + |
| 46 | +### Building From Sources |
| 47 | +Building from sources requires Node.js® version 16 or higher. [Click here to install Node.js](https://nodejs.org/en/) |
| 48 | + |
| 49 | +```bash |
| 50 | +git clone https://github.com/mathworks/matlab-proxy.git |
| 51 | + |
| 52 | +cd matlab-proxy |
| 53 | + |
| 54 | +python -m pip install . |
| 55 | +``` |
| 56 | + |
| 57 | +Installing the package creates an executable called `matlab-proxy-app`, which is placed onto your system PATH by `pip`, usually in: `$HOME/.local/bin/` |
| 58 | +```bash |
| 59 | +# Verify its presence on the PATH |
| 60 | +which matlab-proxy-manager-app |
| 61 | +``` |
| 62 | + |
| 63 | +## Usage |
| 64 | +`matlab-proxy-manager` can be deployed in two modes: |
| 65 | + |
| 66 | +1. Library Mode: Import the relevant module within your client code to invoke public APIs directly. |
| 67 | + |
| 68 | + Example: |
| 69 | + |
| 70 | + ```python |
| 71 | + import matlab_proxy_manager.lib.api as mpm_lib |
| 72 | + response = await mpm_lib.start_matlab_proxy_for_kernel(...) |
| 73 | + await mpm_lib.shutdown(...) |
| 74 | + ``` |
| 75 | + |
| 76 | +2. Process Mode: This mode is primarily managed by Jupyter-Server-Proxy for proxy workflows involving web-based MATLAB desktop access. |
| 77 | + |
| 78 | +## Security |
| 79 | +Security is paramount in matlab-proxy-manager. Communication between the Kernel, proxy manager, and Jupyter Server Proxy is secured using authentication tokens. These tokens are mandatory for API invocations and proxy workflows. They are passed via environment variables when the proxy manager is initiated by the Jupyter Server Proxy and are included in the arguments during Kernel API calls. |
| 80 | + |
| 81 | +--- |
| 82 | + |
| 83 | +Copyright 2024 The MathWorks, Inc. |
| 84 | + |
| 85 | +--- |
0 commit comments