From f75e8206817d0dd4b96c2beae8d9b9ead8910871 Mon Sep 17 00:00:00 2001 From: Krishan Sharma Date: Mon, 27 Oct 2025 11:18:04 +0000 Subject: [PATCH 1/4] Switches to standard build tool and adds source distribution. Replaces hatch with PyPA-recommended build tool. Now generates both wheel and source distributions. --- .github/workflows/publish-jupyter-matlab-proxy.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/publish-jupyter-matlab-proxy.yml b/.github/workflows/publish-jupyter-matlab-proxy.yml index ed3f4cf7..c437da22 100644 --- a/.github/workflows/publish-jupyter-matlab-proxy.yml +++ b/.github/workflows/publish-jupyter-matlab-proxy.yml @@ -1,4 +1,4 @@ -# Copyright 2020-2024 The MathWorks, Inc. +# Copyright 2020-2025 The MathWorks, Inc. name: Publish jupyter-matlab-proxy to PyPI on: @@ -38,10 +38,11 @@ jobs: - name: Install Python build dependencies run: | python3 -m pip install --upgrade pip - python3 -m pip install wheel hatch + python3 -m pip install --upgrade build hatch wheel - - name: Build Source and Binary wheel distributions - run: python3 -m hatch build -t wheel + - name: Build Source and Binary wheel distributions (using recommended tooling) + # https://packaging.python.org/en/latest/guides/tool-recommendations/#building-distributions + run: python3 -m build - name: Publish to PyPI. uses: pypa/gh-action-pypi-publish@release/v1 From 625f9739bd2184f6edb1e700dfe29970cf93d4e2 Mon Sep 17 00:00:00 2001 From: Prabhakar Kumar Date: Mon, 3 Nov 2025 09:58:43 +0000 Subject: [PATCH 2/4] Use Unicode string to represent icon_path. fixes mathworks/jupyter-matlab-proxy#118 --- src/jupyter_matlab_proxy/__init__.py | 2 +- tests/unit/test_jupyter_server_proxy.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/jupyter_matlab_proxy/__init__.py b/src/jupyter_matlab_proxy/__init__.py index ccb9baf0..74d9ef82 100644 --- a/src/jupyter_matlab_proxy/__init__.py +++ b/src/jupyter_matlab_proxy/__init__.py @@ -106,7 +106,7 @@ def setup_matlab(): def _get_jsp_config(logger): - icon_path = Path(__file__).parent / "icon_open_matlab.svg" + icon_path = str(Path(__file__).parent / "icon_open_matlab.svg") logger.debug("Icon_path: %s", icon_path) jsp_config = {} diff --git a/tests/unit/test_jupyter_server_proxy.py b/tests/unit/test_jupyter_server_proxy.py index 063709c4..c5ec6706 100644 --- a/tests/unit/test_jupyter_server_proxy.py +++ b/tests/unit/test_jupyter_server_proxy.py @@ -1,4 +1,4 @@ -# Copyright 2020-2024 The MathWorks, Inc. +# Copyright 2020-2025 The MathWorks, Inc. import inspect import os @@ -88,7 +88,7 @@ def test_setup_matlab(set_mwi_use_fallback_kernel): """ # Setup package_path = Path(inspect.getfile(jupyter_matlab_proxy)).parent - icon_path = package_path / "icon_open_matlab.svg" + icon_path = str(package_path / "icon_open_matlab.svg") expected_matlab_setup = { "command": [ @@ -128,7 +128,7 @@ def test_setup_matlab_with_proxy_manager(monkeypatch): monkeypatch.setattr("jupyter_matlab_proxy._MPM_AUTH_TOKEN", "secret") monkeypatch.setattr("jupyter_matlab_proxy._JUPYTER_SERVER_PID", "123") package_path = Path(inspect.getfile(jupyter_matlab_proxy)).parent - icon_path = package_path / "icon_open_matlab.svg" + icon_path = str(package_path / "icon_open_matlab.svg") expected_matlab_setup = { "command": [matlab_proxy_manager.get_executable_name()], @@ -161,7 +161,7 @@ def test_setup_matlab_with_token_auth_disabled( """ # Setup package_path = Path(inspect.getfile(jupyter_matlab_proxy)).parent - icon_path = package_path / "icon_open_matlab.svg" + icon_path = str(package_path / "icon_open_matlab.svg") monkeypatch.setattr(jupyter_matlab_proxy, "_mwi_auth_token", None) expected_matlab_setup = { From eccf2281221099240ba3e67aa8c206f7b88dcf1b Mon Sep 17 00:00:00 2001 From: Krishan Sharma Date: Wed, 5 Nov 2025 07:55:29 +0000 Subject: [PATCH 3/4] Adds support for alternate syntax to display help for magic commands using the `?` symbol. --- .../magic_execution_engine.py | 5 +++++ src/jupyter_matlab_kernel/magics/README.md | 16 +++++++--------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/jupyter_matlab_kernel/magic_execution_engine.py b/src/jupyter_matlab_kernel/magic_execution_engine.py index 32d5185d..e7cd176a 100644 --- a/src/jupyter_matlab_kernel/magic_execution_engine.py +++ b/src/jupyter_matlab_kernel/magic_execution_engine.py @@ -145,6 +145,11 @@ def get_magics_from_cell(cell_code): params = magic_dict["params"].strip() if params: magic_dict["params"] = re.split("\s+", params) + # transform ? parameter into a help magic, such that %%file? becomes %%help file + if params.startswith("?"): + # Ignore additional parameters after the ? parameter + magic_dict["params"] = [magic_dict.get("name", "")] + magic_dict["name"] = "help" else: magic_dict["params"] = [] magic_dict["line_number"] = line_number diff --git a/src/jupyter_matlab_kernel/magics/README.md b/src/jupyter_matlab_kernel/magics/README.md index 4ef20833..117bfe43 100644 --- a/src/jupyter_matlab_kernel/magics/README.md +++ b/src/jupyter_matlab_kernel/magics/README.md @@ -1,24 +1,22 @@ # Magic Commands for MATLAB Kernel -You can use magic commands with the MATLAB kernel. You can use the predefined magic commands in this folder, and you can implement your own by following the steps below. +This guide shows how to use magic commands with the MATLAB kernel for added functionality. ## Get Started -Magic commands for the MATLAB kernel are prefixed with two percentage symbols `%%` without whitespaces. For example, to list available magic commands, run `%%lsmagic` +Magic commands for the MATLAB kernel are prefixed with two percentage symbols `%%` without whitespaces. For example, to list available magic commands, run `%%lsmagic`. To read the documentation of a magic command, use the help command `?` or `help`, for example `%%lsmagic?` or `%%help lsmagic`. -Note that magic commands will only work at the beginning of cells, and will not work with MATLAB variables. - -The magic commands `help` and `file` accept additional parameters. For example, to display information about a magic command, run `%%help` followed by the name of the magic as an argument: `%%help time` +Note that magic commands only work at the beginning of cells. This table lists the predefined magic commands you can use: |Name|Description|Additional Parameters|Constraints|Example command| |---|---|---|---|---| -|lsmagic|List predefined magic commands.|||`%%lsmagic`| -|help|Display information about provided magic command. | Name of magic command.|| `%%help file`| -|time|Display time taken to execute a cell.|||`%%time`| -|file|Save contents of cell as a file in the notebook folder. You can use this command to define and save new functions. For details, see the section below on how to [Create New Functions Using the %%file Magic Command](#create-new-functions-using-the-the-file-magic-command)|Name of saved file|The file magic command will save the contents of the cell, but not execute them in MATLAB|`%%file myfile.m`| +|`?` and `help`| Display documentation of given magic command.|Name of magic command.||`%%lsmagic?` or `%%help lsmagic`| +|`lsmagic`|List predefined magic commands.|||`%%lsmagic`| +|`time`|Display time taken to execute a cell.|||`%%time`| +|`file`|Save contents of cell as a file in the notebook folder. You can use this command to define and save new functions. For details, see the section below on how to [Create New Functions Using the %%file Magic Command](#create-new-functions-using-the-the-file-magic-command)|Name of saved file.|The file magic command will save the contents of the cell, but not execute them in MATLAB.|`%%file myfile.m`| To request a new magic command, [create an issue](https://github.com/mathworks/jupyter-matlab-proxy/issues/new/choose). From 67efed41973e0ab10d5bea1e8bcbd8645445895d Mon Sep 17 00:00:00 2001 From: Prabhakar Kumar Date: Mon, 17 Nov 2025 12:31:10 +0530 Subject: [PATCH 4/4] Update to v0.17.2 --- .github/workflows/test-jupyter-matlab-proxy.yml | 1 + pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test-jupyter-matlab-proxy.yml b/.github/workflows/test-jupyter-matlab-proxy.yml index 67c3a975..93e37f8a 100644 --- a/.github/workflows/test-jupyter-matlab-proxy.yml +++ b/.github/workflows/test-jupyter-matlab-proxy.yml @@ -7,6 +7,7 @@ on: push: branches: - "main" + - "integration/**" paths: # Only run tests when there are changes to these folders - "src/**" diff --git a/pyproject.toml b/pyproject.toml index 1b486d46..4054bdbc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ build-backend = "hatchling.build" [project] name = "jupyter-matlab-proxy" -version = "0.17.1" +version = "0.17.2" description = "MATLAB Integration for Jupyter" readme = "README.md" license = { file = "LICENSE.md" }