From a5a51819d19b9ccd06e26537dcd3c47b61774b81 Mon Sep 17 00:00:00 2001 From: Tanmay Das Date: Fri, 27 Jan 2023 14:21:08 +0000 Subject: [PATCH] Update workflow strategy matrix, action versions & black formatting. --- .github/workflows/release.yml | 12 +++++++----- .github/workflows/run-tests.yml | 16 ++++++++++------ src/jupyter_matlab_kernel/mwi_comm_helpers.py | 8 ++++++-- 3 files changed, 23 insertions(+), 13 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 12d6646a..27be82f1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,4 +1,6 @@ -# Copyright 2020-2021 The MathWorks, Inc +# Copyright (c) 2020-2023 The MathWorks, Inc + +# Workflow to release MATLAB Jupyter Integration to PyPi name: Release to PyPI on: @@ -11,12 +13,12 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: ref: ${{github.sha}} - name: Set up Python 3.7 - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: 3.7 @@ -39,12 +41,12 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: ref: ${{github.sha}} - name: Set up Python 3.7 - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: 3.7 diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index a2515f11..a4119104 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -1,4 +1,7 @@ -name: MATLAB Jupyter Integration +# Copyright (c) 2020-2023 The MathWorks, Inc + +# Workflow that contains jobs to test MATLAB Jupyter Integration +name: Testing MATLAB Jupyter Integration on: push: @@ -9,15 +12,16 @@ jobs: python_tests: runs-on: ubuntu-latest strategy: + fail-fast: false matrix: - python-version: [3.7, 3.8, 3.9, 3.10] + python-version: ['3.7', '3.8', '3.9', '3.10'] steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} @@ -42,10 +46,10 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Set up Python 3.7 - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: 3.7 diff --git a/src/jupyter_matlab_kernel/mwi_comm_helpers.py b/src/jupyter_matlab_kernel/mwi_comm_helpers.py index 6a7023af..46b16ff3 100644 --- a/src/jupyter_matlab_kernel/mwi_comm_helpers.py +++ b/src/jupyter_matlab_kernel/mwi_comm_helpers.py @@ -162,7 +162,7 @@ def _send_feval_request_to_matlab(url, headers, fname, nargout, *args): def _send_eval_request_to_matlab(url, headers, mcode): # Add the MATLAB code shipped with kernel to the Path path = str(pathlib.Path(__file__).parent / "matlab") - mcode = "addpath(\"" + path + "\")" + ";" + mcode + mcode = 'addpath("' + path + '")' + ";" + mcode req_body = get_data_to_eval_mcode(mcode) resp = requests.post( @@ -241,7 +241,11 @@ def _send_jupyter_request_to_matlab(url, headers, request_type, inputs): # code. Also, we need to escape the backslash (\) character so that the # string which needs to be evaluated isn't broken down by MATLAB due to # formatting - args = f"'{request_type}', '{execution_request_type}', '" + json.dumps(user_mcode.replace("'", "''")) + f"'" + args = ( + f"'{request_type}', '{execution_request_type}', '" + + json.dumps(user_mcode.replace("'", "''")) + + f"'" + ) if request_type == "complete": cursor_pos = inputs[3] args = args + "," + str(cursor_pos)