Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: mathworks/jupyter-matlab-proxy
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.11.0
Choose a base ref
...
head repository: mathworks/jupyter-matlab-proxy
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref
Loading
Showing with 19,964 additions and 9,330 deletions.
  1. +72 −0 .github/ISSUE_TEMPLATE/bug-report.yml
  2. +7 −0 .github/ISSUE_TEMPLATE/config.yml
  3. +26 −0 .github/ISSUE_TEMPLATE/feature-request.yml
  4. +13 −13 .github/workflows/{release.yml → publish-jupyter-matlab-proxy.yml}
  5. +65 −0 .github/workflows/publish-tljh-matlab.yml
  6. +9 −11 .github/workflows/run-e2e-tests.yml
  7. +21 −19 .github/workflows/run-integration-tests.yml
  8. +85 −7 .github/workflows/run-unit-tests.yml
  9. +11 −7 .github/workflows/{run-tests.yml → test-jupyter-matlab-proxy.yml}
  10. +50 −0 .github/workflows/test-tljh-matlab.yml
  11. +6 −0 .gitignore
  12. +3 −3 limitations.md → Limitations.md
  13. +0 −31 MATLAB-Licensing-Info.md
  14. +63 −28 README.md
  15. +8 −1 SECURITY.md
  16. +32 −0 hatch_build.py
  17. BIN img/tljh.png
  18. +3 −0 install_guides/the-littlest-jupyterhub/.matlab_env
  19. +51 −0 install_guides/the-littlest-jupyterhub/README.md
  20. +77 −0 install_guides/the-littlest-jupyterhub/start-container-with-tljh-matlab.sh
  21. +162 −0 install_guides/the-littlest-jupyterhub/tljh-matlab/.gitignore
  22. +16 −0 install_guides/the-littlest-jupyterhub/tljh-matlab/LICENSE
  23. +50 −0 install_guides/the-littlest-jupyterhub/tljh-matlab/README.md
  24. +11 −0 install_guides/the-littlest-jupyterhub/tljh-matlab/SECURITY.md
  25. +23 −0 install_guides/the-littlest-jupyterhub/tljh-matlab/setup.py
  26. +1 −0 install_guides/the-littlest-jupyterhub/tljh-matlab/src/__init__.py
  27. +1 −0 install_guides/the-littlest-jupyterhub/tljh-matlab/src/tljh_matlab/__init__.py
  28. +34 −0 install_guides/the-littlest-jupyterhub/tljh-matlab/src/tljh_matlab/bash_scripts/install-matlab.sh
  29. +34 −0 install_guides/the-littlest-jupyterhub/tljh-matlab/src/tljh_matlab/install_matlab.py
  30. +24 −0 install_guides/the-littlest-jupyterhub/tljh-matlab/src/tljh_matlab/tljh_matlab.py
  31. +57 −0 install_guides/vscode/README.md
  32. BIN install_guides/vscode/img/click-on-jupyter-kernel.png
  33. BIN install_guides/vscode/img/kernel-picker.png
  34. BIN install_guides/vscode/img/matlab.png
  35. BIN install_guides/vscode/img/pick-matlab-kernel.png
  36. BIN install_guides/vscode/img/play-button.png
  37. BIN install_guides/vscode/img/selected-kernel.png
  38. +338 −0 install_guides/wsl2/README.md
  39. BIN install_guides/wsl2/img/changing-wsl-version.png
  40. BIN install_guides/wsl2/img/enable-required-options.png
  41. BIN install_guides/wsl2/img/enter-license-detail.png
  42. BIN install_guides/wsl2/img/install-MATLAB.png
  43. BIN install_guides/wsl2/img/jupyter-final-output.png
  44. BIN install_guides/wsl2/img/jupyter-window.png
  45. BIN install_guides/wsl2/img/set-matlab-path.png
  46. BIN install_guides/wsl2/img/setting-username-password.png
  47. BIN install_guides/wsl2/img/start-jupyter-lab.png
  48. BIN install_guides/wsl2/img/turn-windows-feature-on-or-off.png
  49. +39 −15 pyproject.toml
  50. +12 −41 src/jupyter_matlab_kernel/README.md
  51. +5 −2 src/jupyter_matlab_kernel/__main__.py
  52. +615 −0 src/jupyter_matlab_kernel/base_kernel.py
  53. +204 −0 src/jupyter_matlab_kernel/jsp_kernel.py
  54. +0 −18 src/jupyter_matlab_kernel/kernel.json
  55. +0 −612 src/jupyter_matlab_kernel/kernel.py
  56. +45 −0 src/jupyter_matlab_kernel/kernel_factory.py
  57. +166 −0 src/jupyter_matlab_kernel/kernelspec.py
  58. BIN {img → src/jupyter_matlab_kernel/kernelspec}/logo-64x64.png
  59. 0 {img → src/jupyter_matlab_kernel/kernelspec}/logo-svg.svg
  60. +613 −0 src/jupyter_matlab_kernel/magic_execution_engine.py
  61. +27 −0 src/jupyter_matlab_kernel/magic_helper.py
  62. +70 −0 src/jupyter_matlab_kernel/magics/README.md
  63. +148 −0 src/jupyter_matlab_kernel/magics/base/matlab_magic.py
  64. +38 −0 src/jupyter_matlab_kernel/magics/file.py
  65. +59 −0 src/jupyter_matlab_kernel/magics/help.py
  66. +21 −0 src/jupyter_matlab_kernel/magics/lsmagic.py
  67. +43 −0 src/jupyter_matlab_kernel/magics/time.py
  68. +3 −1 src/jupyter_matlab_kernel/matlab/+jupyter/complete.m
  69. +181 −0 src/jupyter_matlab_kernel/mpm_kernel.py
  70. +348 −306 src/jupyter_matlab_kernel/mwi_comm_helpers.py
  71. +42 −0 src/jupyter_matlab_kernel/mwi_exceptions.py
  72. +55 −0 src/jupyter_matlab_kernel/test_utils.py
  73. +3 −0 src/jupyter_matlab_labextension/.eslintrc.json
  74. +1 −0 src/jupyter_matlab_labextension/.yarnrc.yml
  75. +7 −0 src/jupyter_matlab_labextension/jest.config.js
  76. +31 −16 src/jupyter_matlab_labextension/package.json
  77. +39 −0 src/jupyter_matlab_labextension/src/codemirror-lang-matlab/codemirror-lang-matlab.ts
  78. +43 −0 src/jupyter_matlab_labextension/src/codemirror-lang-matlab/indent-matlab.ts
  79. +49 −0 src/jupyter_matlab_labextension/src/codemirror-lang-matlab/test/indent-matlab.test.ts
  80. +3 −3 src/jupyter_matlab_labextension/src/index.ts
  81. +4 −0 src/jupyter_matlab_labextension/src/lezer-matlab/dist/index.d.cts
  82. +4 −0 src/jupyter_matlab_labextension/src/lezer-matlab/dist/index.d.ts
  83. +1,298 −0 src/jupyter_matlab_labextension/src/lezer-matlab/package-lock.json
  84. +36 −0 src/jupyter_matlab_labextension/src/lezer-matlab/package.json
  85. +26 −0 src/jupyter_matlab_labextension/src/lezer-matlab/rollup.config.js
  86. +18 −0 src/jupyter_matlab_labextension/src/lezer-matlab/src/highlight.js
  87. +47 −0 src/jupyter_matlab_labextension/src/lezer-matlab/src/matlab.grammar
  88. +160 −0 src/jupyter_matlab_labextension/src/lezer-matlab/src/parse_comments.js
  89. +89 −0 src/jupyter_matlab_labextension/src/lezer-matlab/test/additional_cases.txt
  90. +88 −0 src/jupyter_matlab_labextension/src/lezer-matlab/test/basic_terms.txt
  91. +81 −0 src/jupyter_matlab_labextension/src/lezer-matlab/test/nested_terms.txt
  92. +46 −0 src/jupyter_matlab_labextension/src/lezer-matlab/test/test-long-matlab-files.js
  93. +24 −0 src/jupyter_matlab_labextension/src/lezer-matlab/test/test-matlab.js
  94. +41 −0 src/jupyter_matlab_labextension/src/matlab_cm6_mode.ts
  95. +0 −78 src/jupyter_matlab_labextension/src/matlab_cm_mode.ts
  96. +2 −2 src/jupyter_matlab_labextension/src/matlab_files.ts
  97. +3 −1 src/jupyter_matlab_labextension/tsconfig.json
  98. +9,105 −4,933 src/jupyter_matlab_labextension/yarn.lock
  99. +1 −1 src/jupyter_matlab_proxy/README.md
  100. +89 −42 src/jupyter_matlab_proxy/__init__.py
  101. +1 −0 tests/__init__.py
  102. +5 −0 tests/e2e/jupyter_server_test_config.py
  103. +2,727 −2,476 tests/e2e/package-lock.json
  104. +2 −2 tests/e2e/package.json
  105. +10 −59 tests/e2e/tests/matlab_execution.test.ts
  106. +4 −9 tests/e2e/tests/ui_tests.test.ts
  107. +0 −176 tests/e2e/tests/utils/licensing.ts
  108. +0 −54 tests/e2e/tests/utils/matlab_notebook.ts
  109. +1 −0 tests/integration/__init__.py
  110. +84 −115 tests/integration/conftest.py
  111. +18 −3 tests/integration/test_matlab_integration.py
  112. +1 −0 tests/integration/utils/__init__.py
  113. +65 −57 tests/integration/{ → utils}/integration_test_utils.py
  114. +176 −0 tests/integration/utils/licensing.py
  115. +49 −0 tests/matlab-tests/TestCompleteFunction.m
  116. +77 −0 tests/matlab-tests/TestExecuteFunction.m
  117. +43 −0 tests/matlab-tests/TestGetOrStashExceptionsFunction.m
  118. +65 −0 tests/matlab-tests/TestIdlerFunction.m
  119. +50 −0 tests/unit/jupyter_matlab_kernel/magics/test_file.py
  120. +76 −0 tests/unit/jupyter_matlab_kernel/magics/test_help.py
  121. +25 −0 tests/unit/jupyter_matlab_kernel/magics/test_lsmagic.py
  122. +52 −0 tests/unit/jupyter_matlab_kernel/magics/test_time.py
  123. +12 −12 tests/unit/jupyter_matlab_kernel/mocks/mock_http_responses.py
  124. +11 −6 tests/unit/jupyter_matlab_kernel/mocks/mock_jupyter_server.py
  125. +35 −3 tests/unit/jupyter_matlab_kernel/test_kernel.py
  126. +50 −0 tests/unit/jupyter_matlab_kernel/test_kernel_factory.py
  127. +13 −10 tests/unit/jupyter_matlab_kernel/test_kernel_json.py
  128. +300 −0 tests/unit/jupyter_matlab_kernel/test_kernelspec.py
  129. +223 −0 tests/unit/jupyter_matlab_kernel/test_magic_execution_engine.py
  130. +15 −0 tests/unit/jupyter_matlab_kernel/test_magic_helper.py
  131. +170 −0 tests/unit/jupyter_matlab_kernel/test_mpm_kernel.py
  132. +70 −67 tests/unit/jupyter_matlab_kernel/test_mwi_comm_helpers.py
  133. +76 −12 tests/unit/test_jupyter_server_proxy.py
  134. +33 −78 troubleshooting/troubleshooting.md
72 changes: 72 additions & 0 deletions .github/ISSUE_TEMPLATE/bug-report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# Copyright 2024 The MathWorks, Inc.

name: "🐞 Bug Report"
title: "[Enter short description of bug.]"
description: "Report a bug."
labels: [bug, needs-triage]
body:
- type: markdown
attributes:
value: |
Before reporting a bug, see [Issues](https://github.com/mathworks/jupyter-matlab-proxy/issues) to check if an issue already exists for the bug you encountered. To request a feature or report a vulnerability, return to [Create an Issue](https://github.com/mathworks/jupyter-matlab-proxy/issues/new/choose).
- type: markdown
attributes:
value: |
## Provide details about the bug:
* What is the problem?
* What behavior were you expecting?
* What happened instead?
* Include full errors, uncaught exceptions, stack traces, and relevant logs.
* Provide a sequence of steps to reproduce the issue.
* Suggest a fix, if possible.
* Any additional information that might be relevant.
- type: textarea
id: bug-summary
attributes:
label: Summary

- type: dropdown
id: browsers
attributes:
label: Browser(s) used
multiple: true
options:
- Chrome
- Firefox
- Safari
- Microsoft Edge

- type: dropdown
id: Feature-issue
attributes:
label: Issue found in
multiple: true
options:
- MATLAB Kernel
- MATLAB Desktop
- Syntax Highlighting, Auto Indentation, Tab Completion
- MAGIC Commands
- Others

- type: markdown
attributes:
value: |
## Run the `troubleshooting.py` script and paste the output below.
```bash
$ python ./troubleshooting/troubleshooting.py
```
If you are collecting logs using the MWI_LOG_FILE environment variable, we recommend you provide the variable when executing the troubleshooting script:
```bash
$ MWI_LOG_FILE="/tmp/log.file" python ./troubleshooting/troubleshooting.py
```
For more information about the `MWI_LOG_FILE` environment variable, see [Advanced-Usage.md](https://github.com/mathworks/jupyter-matlab-proxy/blob/main/Advanced-Usage.md)
For more information about the troubleshooting script, see [Troubleshooting](https://github.com/mathworks/jupyter-matlab-proxy/tree/main/troubleshooting)
- type: textarea
id: troubleshooting-script-output
attributes:
label: Script output
7 changes: 7 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Copyright 2024 The MathWorks, Inc.

blank_issues_enabled: true
contact_links:
- name: Report a Security Vulnerability
url: https://github.com/mathworks/jupyter-matlab-proxy/security/policy
about: Follow these steps.
26 changes: 26 additions & 0 deletions .github/ISSUE_TEMPLATE/feature-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Copyright 2024 The MathWorks, Inc.

name: 🚀 Feature Request
description: Suggest a feature for this project.
title: "(short issue description)"
labels: [feature-request, needs-triage]
body:
- type: markdown
attributes:
value: |
To report a bug or security vulnerability, return to [Create an Issue](https://github.com/mathworks/jupyter-matlab-proxy/issues/new/choose).
- type: markdown
attributes:
value: |
## Provide details of the feature you are proposing:
* A brief description
* What use case or challenge would this help you overcome? For example: “Currently, it’s too time-consuming/difficult to do…”
* Suggestions for implementing the request: provide a prototype, sketch, reference etc.
* Any additional information: details, stack traces, related issues, links for context, etc.
- type: textarea
id: description
attributes:
label: Details of the feature

Original file line number Diff line number Diff line change
@@ -1,29 +1,34 @@
# Copyright 2020-2023 The MathWorks, Inc.

# Workflow to release MATLAB Jupyter Integration to PyPi
name: Release to PyPI
# Copyright 2020-2024 The MathWorks, Inc.

name: Publish jupyter-matlab-proxy to PyPI
on:
release:
types: [created]

jobs:
call-unit-tests:
# Runs unit tests
# Only run release jobs on tags which have `jupyter-matlab-proxy` in them
if: ${{ contains(github.ref, 'jupyter-matlab-proxy') }}
# Run unit tests
uses: ./.github/workflows/run-unit-tests.yml
secrets: inherit

build_and_publish_pypi:
# TODO: Add integration-tests as a dependency to
# the release pipeline.
needs: [call-unit-tests]
if: success()
runs-on: ubuntu-latest
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write
environment:
name: pypi
url: https://pypi.org/project/jupyter-matlab-proxy

steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{github.sha}}
ref: ${{ github.sha }}

- name: Set up Python 3.8
uses: actions/setup-python@v4
@@ -40,8 +45,3 @@ jobs:

- name: Publish to PyPI.
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
verbose: true
password: ${{ secrets.PYPI_TOKEN }}
repository_url: ${{ secrets.PYPI_REPOSITORY_URL }}
65 changes: 65 additions & 0 deletions .github/workflows/publish-tljh-matlab.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# Copyright 2024 The MathWorks, Inc.
name: Upload Python Package for tljh-matlab

on:
release:
types: [published]

permissions:
contents: read

jobs:
build-tljh-matlab:
# Only run job if release tag contains `tljh-matlab`
if: ${{ contains(github.ref, 'tljh-matlab') }}

runs-on: ubuntu-latest
defaults:
run:
working-directory: ./install_guides/the-littlest-jupyterhub/tljh-matlab

steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.x'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build package
run: |
python -m build
- name: Upload distributions
uses: actions/upload-artifact@v4
with:
name: release-dists
path: install_guides/the-littlest-jupyterhub/tljh-matlab/dist/

release-tljh-matlab:
runs-on: ubuntu-latest
needs:
- build-tljh-matlab
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write
environment:
name: pypi
url: https://pypi.org/project/tljh-matlab

steps:
- name: Retrieve release distributions
uses: actions/download-artifact@v4
with:
name: release-dists
path: install_guides/the-littlest-jupyterhub/tljh-matlab/dist/

- name: Publish to PyPI.
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: install_guides/the-littlest-jupyterhub/tljh-matlab/dist
20 changes: 9 additions & 11 deletions .github/workflows/run-e2e-tests.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Copyright 2023-2024 The MathWorks, Inc.

name: End-to-End Tests for Jupyter Integration for MATLAB
name: End-to-End Tests for MATLAB Integration for Jupyter
on:
workflow_call:

@@ -15,14 +15,14 @@ jobs:
PYTHON_VERSION: 3.8
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}

- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}

@@ -39,18 +39,16 @@ jobs:

- name: Set up MATLAB
# Use MATLAB Actions to get running MATLAB in GitHub Actions
uses: matlab-actions/setup-matlab@v2-beta
uses: matlab-actions/setup-matlab@v2
with:
products: MATLAB Symbolic_Math_Toolbox



- name: Install jupyterlab and jupyter-matlab-proxy
working-directory: ${{ github.workspace }}
run: |
python3 -m pip install --upgrade pip
python3 -m pip install ".[dev]"
python3 -m pip install "jupyterlab>3.1.0,<4.0.0"
python3 -m pip install "jupyterlab>4.0.0,<5.0.0"
- name: Install playwright browsers
run: npx playwright install --with-deps
@@ -73,8 +71,8 @@ jobs:
run: |
python3 -m pip install --upgrade pip
python3 -m pip install pytest-playwright
python3 -m playwright install
python3 -c "from tests.utils.licensing import *; license_with_online_licensing(log_dir=\"./licensing-logs\")"
python3 -m playwright install chromium --with-deps
(cd tests/utils && python3 -c "from licensing import *; license_with_online_licensing(log_dir=\"./licensing-logs\")")
- name: Run playwright tests
env:
@@ -99,7 +97,7 @@ jobs:
- name: Preserve test results after the job has finished
if: always()
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: e2e_test_results
path: ./tests/e2e/zipped-e2e-test-results.zip
40 changes: 21 additions & 19 deletions .github/workflows/run-integration-tests.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
# Copyright 2020-2023 The MathWorks, Inc.
# Copyright 2023-2024 The MathWorks, Inc.

# Workflow that contains jobs to test MATLAB Jupyter Integration
name: Integration testing MATLAB Jupyter Integration
name: Integration testing MATLAB Integration for Jupyter

on:
# Reusable workflow
# Trigger on workflow call
workflow_call:

jobs:
@@ -19,16 +17,16 @@ jobs:

# The minimum matlab-release is set to 21b as 20b and 21a are not supported by matlab-actions/setup-matlab.
# See https://github.com/matlab-actions/setup-matlab/issues/76
matlab-release: [R2021b, R2023a]
matlab-release: [R2021b, latest]

runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up MATLAB ${{ matrix.matlab-release }}
# Use MATLAB Actions to get running MATLAB in GitHub Actions
uses: matlab-actions/setup-matlab@v2-beta
uses: matlab-actions/setup-matlab@v2
with:
release: ${{ matrix.matlab-release }}
products: MATLAB Symbolic_Math_Toolbox
@@ -50,21 +48,25 @@ jobs:
- name: Ensure browsers are installed for playwright
run: python3 -m playwright install --with-deps

- name: License MATLAB Proxy
env:
TEST_USERNAME: ${{ secrets.TEST_USERNAME }}
TEST_PASSWORD: ${{ secrets.TEST_PASSWORD }}
run: |
python3 -c "from tests.integration.utils import licensing; licensing.start_and_license_matlab_proxy_using_jsp()"
- name: Integration test with pytest
run: python3 -m pytest tests/integration -vs
env:
TEST_USERNAME: ${{secrets.TEST_USERNAME}}
TEST_PASSWORD: ${{secrets.TEST_PASSWORD}}
MWI_LOG_LEVEL: "DEBUG"
MWI_LOG_FILE: ${{github.workspace}}/tests/integration/integ_logs.log

- name: Copy Log File
if: ${{ always() }}
run: |
cp ${{ github.workspace }}/tests/integration/integ_logs.log ${{ matrix.os }}${{ matrix.matlab-release }}${{ matrix.python-version }}.log
run: python3 -m pytest tests/integration -vs

- name: Make logs files available for downloading
- name: Preserve test logs
if: ${{ always() }}
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: MATLAB Proxy Integration Test Log File
path: ${{ matrix.os }}${{ matrix.matlab-release }}${{ matrix.python-version }}.log
retention-days: 7
name: MATLAB Proxy Integration Test Log File ${{ matrix.os }} matlab-${{ matrix.matlab-release }} python-${{ matrix.python-version }}
path: |
tests/integration/integ_logs.log
licensing-screenshot-failed.png
Loading