Skip to content

Commit 92f5717

Browse files
committed
Initial commit
0 parents  commit 92f5717

File tree

106 files changed

+25107
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

106 files changed

+25107
-0
lines changed
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: MATLAB Jupyter Integration
2+
3+
on: [push]
4+
5+
jobs:
6+
node_app:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v2
10+
- name: Use Node.js 13.x
11+
uses: actions/setup-node@v1
12+
with:
13+
node-version: 13.x
14+
- run: npm --prefix gui install gui
15+
- run: npm run --prefix gui build --if-present
16+
- run: npm --prefix gui test
17+
env:
18+
CI: true
19+
20+
python_app:
21+
needs: node_app
22+
runs-on: ubuntu-latest
23+
strategy:
24+
matrix:
25+
python-version: [3.6, 3.7, 3.8]
26+
steps:
27+
- uses: actions/checkout@v2
28+
- name: Set up Python ${{ matrix.python-version }}
29+
uses: actions/setup-python@v2
30+
with:
31+
python-version: ${{ matrix.python-version }}
32+
- name: Install dependencies
33+
run: |
34+
python -m pip install --upgrade pip
35+
pip install black pytest
36+
- name: Lint with black
37+
run: |
38+
black --check .
39+
- name: Test with pytest
40+
run: |
41+
pytest
42+
43+
python_app_wheel:
44+
if: startsWith(github.ref, 'refs/tags/v')
45+
needs: python_app
46+
runs-on: ubuntu-latest
47+
steps:
48+
- uses: actions/checkout@v2
49+
- name: Set up Python 3.7
50+
uses: actions/setup-python@v2
51+
with:
52+
python-version: 3.7
53+
- name: Install dependencies
54+
run: |
55+
python -m pip install --upgrade pip
56+
pip install wheel
57+
- name: Use Node.js 13.x
58+
uses: actions/setup-node@v1
59+
with:
60+
node-version: 13.x
61+
- name: Build wheel
62+
run: |
63+
python setup.py bdist_wheel
64+
- name: Create Release
65+
id: create_release
66+
uses: actions/create-release@v1
67+
env:
68+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
69+
with:
70+
tag_name: ${{ github.ref }}
71+
release_name: Release ${{ github.ref }}
72+
body: Release ${{ github.ref }}
73+
draft: false
74+
prerelease: false

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
*.egg-info/
2+
.eggs/
3+
__pycache__/
4+
build/
5+
dist/
6+
.venv/

Development_Customization_Info.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Development Customization
2+
3+
To develop the JavaScript Single-page application and Python application with live-reloading,
4+
start a development server for both.
5+
The JavaScript development server proxies all requests that it does not recognise
6+
to the Python development server.
7+
8+
To start the JavaScript development server, execute:
9+
10+
```bash
11+
# Change into the directory gui
12+
cd gui
13+
# Install the node dependencies
14+
npm install
15+
# Start the development server
16+
npm start
17+
```
18+
19+
To start the Python development server, in a separate shell, execute:
20+
21+
```bash
22+
# Create a Python virtual environment if one does not already exist (skip this step if one exists)
23+
python -m venv .venv
24+
# Activate the Python virtual environment (skip this if already done)
25+
source .venv/bin/activate
26+
# Install the Python package (and dependencies) in development mode (skip this if already done)
27+
pip install -e .[dev]
28+
# Start the development server
29+
DEV=true adev runserver jupyter_matlab_proxy/app.py
30+
```
31+
32+
If you make any changes to either the JavaScript code or the Python code, then these apps will reload immediately showing the results. Bear in mind that this kind of live-reloading can have an impact on application state (on the serverside particularly). This occurs independently for the JavaScript and Python applications. So if you are working only on the frontend, the backend state will never be affected by changes to the frontend and vice-versa.
33+
34+
In development mode, no MATLAB is required. Where MATLAB and Xvfb would have their processes launched, placeholder processes are launched in their stead.

LICENSE.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
MATHWORKS CLOUD REFERENCE ARCHITECTURE LICENSE
2+
3+
The files in this GitHub repository refer to commercial software products and services, virtual machine images, and related materials of The MathWorks, Inc. (“MathWorks Programs”). MathWorks Programs are separately licensed under the MathWorks Software License Agreement, available in the desktop installation of the MathWorks Programs or in the virtual machine image. The files in this GitHub repository may also refer to third-party software licensed under separate terms provided by such third parties.
4+
5+
The following license terms apply only to the files in this GitHub repository, including files in this folder and its subfolders, and do not apply to MathWorks Programs. References to “software” and “code” in the following license terms refer to the files in this GitHub repository.
6+
7+
Copyright (c) 2020, The MathWorks, Inc.
8+
9+
All rights reserved.
10+
11+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
12+
13+
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
14+
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
15+
3. In all cases, the software is, and all modifications and derivatives of the software shall be, licensed to you solely for use in conjunction with MathWorks products and service offerings.
16+
17+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

MANIFEST.in

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
include README.md
2+
recursive-include jupyter_matlab_proxy/icons *
3+
recursive-include jupyter_matlab_proxy/matlab *
4+
recursive-include gui *
5+
recursive-exclude gui/node_modules *
6+
recursive-exclude gui/build *

MATLAB_Licensing_Info.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# MATLAB Licensing Info
2+
3+
4+
**For End Users**:
5+
6+
When starting MATLAB through this integration, you are presented with a user interface with two options to set up MATLAB licensing.
7+
8+
<p align="center">
9+
<img width="400" src="img/licensing_GUI.png">
10+
</p>
11+
12+
To choose the right option, determine what MATLAB licenses you have access to. Your license must be current on [MathWorks® Software Maintenance Service](https://www.mathworks.com/services/maintenance.html). 
13+
14+
15+
16+
If you are an academic user, you can use [this tool](https://www.mathworks.com/licensecenter/licenses/add) to determine if you have access to a campus-wide license through your institution. Otherwise, to see the licenses linked to your account, log in to your MathWorks account and go to [License Center](https://www.mathworks.com/licensecenter/?s_tid=hp_ff_s_license). You can link your MathWorks account with a license using [this tool](https://www.mathworks.com/licensecenter/licenses/add).
17+
18+
19+
20+
Based on the license that you want to use, you can follow the procedures outlined in the table below to setup the MATLAB licensing for this integration.
21+
22+
23+
| License Type | Procedure |
24+
| ------ | ------ |
25+
| Individual (that only you use and is in your name; not a Home or Student) | Your license is already configured for use with MATLAB Integration for Jupyter. Using the _Online License Manager_ tab, enter the credentials to your MathWorks account to get started. |
26+
| Campus-Wide License | Your license is already configured for use with MATLAB Integration for Jupyter. Using the _Online License Manager_ tab, enter the credentials to your MathWorks account to get started. |
27+
| Home and Student (that only you use and is in your name) | These license types are not supported for use with MATLAB Integration for Jupyter. |
28+
| Concurrent and Network Named User | Using the _Network License Manager_ tab, enter the address to your organization’s network license manager. You can contact your license administrator* to find the address for the network license manager. |
29+
30+
31+
*Not sure who the license administrator is? Sign in to your [MathWorks Account](https://www.mathworks.com/mwaccount/), click the license you are using, then click the tab marked “Contact Administrators”.
32+
33+
**For Administrators**
34+
35+
36+
| Scenario | License Type | Procedure |
37+
| ------ | ------ | ------ |
38+
| You want your users to use online licensing | Campus-Wide, Individual | These licenses are already configured for use with MATLAB Integration for Jupyter. When starting MATLAB, an end user will need to log in to their MathWorks account to use the license linked to it. |
39+
| You want your users to use licenses administered using a network license manager | Campus-Wide, Concurrent, or Network Named User | You will need to embed the address of your network license manager when deploying the integration for your Jupyter environment. Otherwise, an end user will need to manually enter the address to the network license manager when they start MATLAB. Each instance of MATLAB will consume a license seat. Using network named user licenses is possible but is *not recommended*. All named users will need to be explicitly specified in the license manager options file. Named users may not use MathWorks products on more than two computers simultaneously - specifying a single, generic named user for the integration will not be viable. |

README.md

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
# MATLAB Integration for Jupyter
2+
3+
The `jupyter-matlab-proxy` Python® package allows you to integrate MATLAB® with Jupyter®. The MATLAB integration for Jupyter enables you to open a MATLAB desktop in a web browser tab, directly from your Jupyter environment. This is not a kernel integration.
4+
5+
The MATLAB Integration for Jupyter is under active development and you might find issues with the MATLAB graphical user interface. For support or to report issues, see the [Feedback](#Feedback) section.
6+
7+
8+
## Use the MATLAB Integration for Jupyter
9+
10+
Once you have a Jupyter environment with the `jupyter-matlab-proxy` package installed, to use the integration, follow these steps:
11+
12+
1. Open your Jupyter environment.
13+
14+
2. If you are using Jupyter Notebook (on the left in figure below), on the `New` menu, select `MATLAB`. If you are using JupyterLab (on the right in figure below), select the MATLAB icon on the launcher.
15+
16+
<p align="center">
17+
<img width="600" src="img/combined_launchers.png">
18+
</p>
19+
20+
3. If prompted to do so, enter credentials for a MathWorks account associated with a MATLAB license. If you are using a network license manager, change to the _Network License Manager_ tab and enter the license server address instead. To determine the appropriate method for your license type, consult [MATLAB Licensing Info](./MATLAB_Licensing_Info.md).
21+
22+
<p align="center">
23+
<img width="400" src="img/licensing_GUI.png">
24+
</p>
25+
26+
4. Wait for the MATLAB session to start. This can take several minutes.
27+
28+
5. To manage the MATLAB integration for Jupyter, click the tools icon shown below.
29+
30+
<p align="center">
31+
<img width="100" src="img/tools_icon.png">
32+
</p>
33+
34+
6. Clicking the tools icon opens a status panel with buttons like the ones below:
35+
36+
<p align="center">
37+
<img width="800" src="img/status_panel.png">
38+
</p>
39+
40+
The following options are available in the status panel (some options are only available in a specific context):
41+
42+
* Start MATLAB Session — Start your MATLAB session. Available if MATLAB is stopped.
43+
* Restart MATLAB Session — Restart your MATLAB session. Available if MATLAB is running or starting.
44+
* Stop MATLAB Session — Stop your MATLAB session. Use this option if you want to free up RAM and CPU resources. Available if MATLAB is running or starting.
45+
* Sign Out — Sign out of MATLAB. Use this to stop MATLAB and sign in with an alternative account. Available if using online licensing.
46+
* Unset License Server Address — Unset network license manager server address. Use this to stop MATLAB and enter new licensing information. Available if using network license manager.
47+
* Feedback — Send feedback about the MATLAB Integration for Jupyter. This action opens your default email application.
48+
* Help — Open a help pop-up for a detailed description of the options.
49+
50+
51+
## Installation
52+
53+
The `jupyter-matlab-proxy` package requires a Linux® operating system.
54+
55+
If you want to install this package in a Jupyter Docker® image, see [Use MATLAB Integration for Jupyter in a Docker Container](https://github.com/mathworks-ref-arch/matlab-integration-for-jupyter/tree/main/matlab). Otherwise, if you want to install the `jupyter-matlab-proxy` package into a preexisting Jupyter environment, follow the instructions below.
56+
57+
To install the `jupyter-matlab-proxy` package, follow these steps in your Jupyter environment on a Linux OS:
58+
59+
1. Install a MATLAB 64 bit Linux version. Make sure the the installation folder is on the system path. This integration supports MATLAB R2020b or later. For earlier versions, use the alternative [MATLAB Integration for Jupyter using VNC](https://github.com/mathworks/jupyter-matlab-vnc-proxy).
60+
2. Install software packages that MATLAB depends on and software packages that this integration depends on. For a list of required software packages in a Debian based distribution, inspect [this Dockerfile](https://github.com/mathworks-ref-arch/matlab-integration-for-jupyter/blob/main/matlab/Dockerfile).
61+
3. Install [Node and Node Package Manager](https://nodejs.org/en/) version 13 or higher.
62+
4. Install the `jupyter-matlab-proxy` package by executing:
63+
```bash
64+
python -m pip install https://github.com/mathworks/jupyter-matlab-proxy/archive/0.1.0.tar.gz
65+
```
66+
67+
If you want to use this integration with JupyterLab®, you must also install `jupyterlab-server-proxy` JupyterLab extension. To install the extension, use the following command:
68+
69+
``` bash
70+
jupyter labextension install @jupyterlab/server-proxy
71+
```
72+
73+
For more information see [GUI Launchers](https://jupyter-server-proxy.readthedocs.io/en/latest/launchers.html#jupyterlab-launcher-extension).
74+
75+
76+
### Limitations
77+
78+
This package supports the same subset of MATLAB features and commands as MATLAB Online. For a full list supported products and limitations, see [Specifications and Limitations](https://www.mathworks.com/products/matlab-online/limitations.html). For a list of browser requirements, see [Cloud Solutions Browser Requirements](https://www.mathworks.com/support/requirements/browser-requirements.html). If you need to use functionality that is not yet supported, you can leverage the alternative [MATLAB Integration for Jupyter using VNC](https://github.com/mathworks/jupyter-matlab-vnc-proxy).
79+
80+
### Integration with JupyterHub
81+
82+
If you want to use this integration with JupyterHub®, then you must install the `jupyter-matlab-proxy` Python package in the Jupyter environment launched by your JupyterHub platform. For example, if your JupyterHub platform launches Docker containers, then install this package in the Docker image used to launch them. You can find a reference architecture that installs the `jupyter-matlab-proxy` Python package in a Docker image in the repository [Use MATLAB Integration for Jupyter in a Docker Container](https://github.com/mathworks-ref-arch/matlab-integration-for-jupyter/tree/main/matlab).
83+
84+
85+
## Feedback
86+
87+
We encourage you to try this repository with your environment and provide feedback – the technical team is monitoring this repository. If you encounter a technical issue or have an enhancement request, send an email to `[email protected]`.

SECURITY.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Reporting Security Vulnerabilities
2+
==================================
3+
If you believe you have discovered a security vulnerability, please report it to
4+
[email protected] instead of GitHub. Please see
5+
[MathWorks Vulnerability Disclosure Policy for Security Researchers](https://www.mathworks.com/company/aboutus/policies_statements/vulnerability-disclosure-policy.html)
6+
for additional information.

gui/.gitignore

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
/.pnp
6+
.pnp.js
7+
8+
# testing
9+
/coverage
10+
11+
# production
12+
/build
13+
14+
# misc
15+
.DS_Store
16+
.env.local
17+
.env.development.local
18+
.env.test.local
19+
.env.production.local
20+
21+
npm-debug.log*
22+
yarn-debug.log*
23+
yarn-error.log*

gui/README.md

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
2+
3+
## Available Scripts
4+
5+
In the project directory, you can run:
6+
7+
### `npm start`
8+
9+
Runs the app in the development mode.<br />
10+
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
11+
12+
The page will reload if you make edits.<br />
13+
You will also see any lint errors in the console.
14+
15+
### `npm test`
16+
17+
Launches the test runner in the interactive watch mode.<br />
18+
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
19+
20+
### `npm run build`
21+
22+
Builds the app for production to the `build` folder.<br />
23+
It correctly bundles React in production mode and optimizes the build for the best performance.
24+
25+
The build is minified and the filenames include the hashes.<br />
26+
Your app is ready to be deployed!
27+
28+
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
29+
30+
### `npm run eject`
31+
32+
**Note: this is a one-way operation. Once you `eject`, you can’t go back!**
33+
34+
If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
35+
36+
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.
37+
38+
You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.
39+
40+
## Learn More
41+
42+
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
43+
44+
To learn React, check out the [React documentation](https://reactjs.org/).
45+
46+
### Code Splitting
47+
48+
This section has moved here: https://facebook.github.io/create-react-app/docs/code-splitting
49+
50+
### Analyzing the Bundle Size
51+
52+
This section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size
53+
54+
### Making a Progressive Web App
55+
56+
This section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app
57+
58+
### Advanced Configuration
59+
60+
This section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration
61+
62+
### Deployment
63+
64+
This section has moved here: https://facebook.github.io/create-react-app/docs/deployment
65+
66+
### `npm run build` fails to minify
67+
68+
This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify

0 commit comments

Comments
 (0)