From 09a1464fd8e1421362374cc1c15d5249e856e01c Mon Sep 17 00:00:00 2001 From: dalthviz <16781833+dalthviz@users.noreply.github.com> Date: Mon, 30 Sep 2024 20:52:39 -0500 Subject: [PATCH 01/10] Editor: Fix 'test_copy_paste_autoindent' forcing text over the clipboard to work --- .../editor/widgets/codeeditor/tests/test_autoindent.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/spyder/plugins/editor/widgets/codeeditor/tests/test_autoindent.py b/spyder/plugins/editor/widgets/codeeditor/tests/test_autoindent.py index ea2f07e0465..c98f8d0edf7 100644 --- a/spyder/plugins/editor/widgets/codeeditor/tests/test_autoindent.py +++ b/spyder/plugins/editor/widgets/codeeditor/tests/test_autoindent.py @@ -469,10 +469,8 @@ def test_copy_paste_autoindent(codeeditor): # Copy cursor = editor.textCursor() cursor.setPosition(30) - cursor.setPosition(59, QTextCursor.KeepAnchor) + cursor.setPosition(51, QTextCursor.KeepAnchor) editor.setTextCursor(cursor) - cb = QApplication.clipboard() - cb.setText("d\n if e:\n f", mode=cb.Clipboard) editor.copy() d = { @@ -495,10 +493,8 @@ def test_copy_paste_autoindent(codeeditor): # Copy cursor = editor.textCursor() cursor.setPosition(30-4) - cursor.setPosition(59, QTextCursor.KeepAnchor) + cursor.setPosition(51, QTextCursor.KeepAnchor) editor.setTextCursor(cursor) - cb = QApplication.clipboard() - cb.setText(" d\n if e:\n f", mode=cb.Clipboard) editor.copy() d = { From b7422d9867a203afa9349cf6ff052a3004255bcd Mon Sep 17 00:00:00 2001 From: "A. Reit" Date: Tue, 1 Oct 2024 07:28:39 +0200 Subject: [PATCH 02/10] Fix setting of working dir in Profiler plugin --- spyder/plugins/profiler/widgets/main_widget.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spyder/plugins/profiler/widgets/main_widget.py b/spyder/plugins/profiler/widgets/main_widget.py index 67fadcbd076..a499bc447b1 100644 --- a/spyder/plugins/profiler/widgets/main_widget.py +++ b/spyder/plugins/profiler/widgets/main_widget.py @@ -518,7 +518,7 @@ def start(self, wdir=None, args=None): if wdir is None: wdir = self._last_wdir if wdir is None: - wdir = osp.basename(filename) + wdir = osp.dirname(filename) if args is None: args = self._last_args From 886873981626663f8f7e9d625dec6acd3bac683b Mon Sep 17 00:00:00 2001 From: Ryan Clary <9618975+mrclary@users.noreply.github.com> Date: Fri, 6 Sep 2024 13:02:48 -0700 Subject: [PATCH 03/10] Fix issue where post-install could not write to shell rc files if files are symlinks. --- installers-conda/resources/post-install.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/installers-conda/resources/post-install.sh b/installers-conda/resources/post-install.sh index 33d3134c6b2..ee56875b5b3 100755 --- a/installers-conda/resources/post-install.sh +++ b/installers-conda/resources/post-install.sh @@ -65,6 +65,9 @@ for shell_init in ${shell_init_list[@]}; do # Don't create non-existent global init file [[ "$mode" == "system" && ! -f "$shell_init" ]] && continue + # Resolve possible symlink + [[ -f $shell_init ]] && shell_init=$(readlink -f $shell_init) + echo "Creating aliases in $shell_init ..." add_alias done @@ -120,7 +123,9 @@ done # Remove aliases from shell startup for x in ${shell_init_list[@]}; do - [[ ! -f "\$x" ]] && continue + # Resolve possible symlink + [[ ! -f "\$x" ]] && continue || x=\$(readlink -f \$x) + echo "Removing Spyder shell commands from \$x..." sed -i.bak -e "/$m1/,/$m2/d" \$x rm \$x.bak From cb972f5108c098dc4fe7f3b78ee72bac1ad26eff Mon Sep 17 00:00:00 2001 From: Ryan Clary <9618975+mrclary@users.noreply.github.com> Date: Fri, 6 Sep 2024 13:10:48 -0700 Subject: [PATCH 04/10] Do not log [un]install for [pre-]releases on Windows. NSIS creates an install.log that prevents clean uninstall. This is undesireble for releases. Note that NSIS_USING_LOG_BUILD environment variable must be unset to disable logging; it cannot be set to "falsey", e.g. 0. --- .github/workflows/installers-conda.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/installers-conda.yml b/.github/workflows/installers-conda.yml index c40f4bc0730..3641f50a6e3 100644 --- a/.github/workflows/installers-conda.yml +++ b/.github/workflows/installers-conda.yml @@ -210,11 +210,12 @@ jobs: - name: Env Variables run: | - NSIS_USING_LOG_BUILD=1 - [[ "$IS_RELEASE" == "true" || "$IS_PRE_RELEASE" == "true" ]] && NSIS_USING_LOG_BUILD=0 - CONDA_BLD_PATH=${RUNNER_TEMP}/conda-bld + if [[ "$IS_RELEASE" != "true" && "$IS_PRE_RELEASE" != "true" ]]; then + NSIS_USING_LOG_BUILD=1 + echo "NSIS_USING_LOG_BUILD=$NSIS_USING_LOG_BUILD" >> $GITHUB_ENV + fi - echo "NSIS_USING_LOG_BUILD=$NSIS_USING_LOG_BUILD" >> $GITHUB_ENV + CONDA_BLD_PATH=${RUNNER_TEMP}/conda-bld echo "CONDA_BLD_PATH=$CONDA_BLD_PATH" >> $GITHUB_ENV env | sort From 4d727f0cf50847bb79b79db849af848311e274da Mon Sep 17 00:00:00 2001 From: Carlos Cordoba Date: Wed, 2 Oct 2024 15:44:56 -0500 Subject: [PATCH 05/10] git subrepo pull (merge) --remote=https://github.com/impact27/spyder-kernels.git --branch=fix_loc --update --force external-deps/spyder-kernels subrepo: subdir: "external-deps/spyder-kernels" merged: "b0da61d0fc" upstream: origin: "https://github.com/impact27/spyder-kernels.git" branch: "fix_loc" commit: "b0da61d0fc" git-subrepo: version: "0.4.9" origin: "https://github.com/ingydotnet/git-subrepo" commit: "ea10886" --- .../.github/workflows/linux-pip-tests.yml | 14 +++++++------- .../.github/workflows/linux-tests.yml | 19 +++++++++---------- .../.github/workflows/macos-tests.yml | 17 ++++++++--------- .../.github/workflows/windows-tests.yml | 15 +++++++-------- external-deps/spyder-kernels/.gitrepo | 10 +++++----- external-deps/spyder-kernels/README.md | 2 +- .../spyder_kernels/customize/code_runner.py | 2 +- .../spyder_kernels/customize/utils.py | 2 +- .../spyder_kernels/utils/iofuncs.py | 11 +++++++++-- .../utils/tests/test_iofuncs.py | 6 +++++- 10 files changed, 53 insertions(+), 45 deletions(-) diff --git a/external-deps/spyder-kernels/.github/workflows/linux-pip-tests.yml b/external-deps/spyder-kernels/.github/workflows/linux-pip-tests.yml index e8d0de90241..1a4f1e5a67e 100644 --- a/external-deps/spyder-kernels/.github/workflows/linux-pip-tests.yml +++ b/external-deps/spyder-kernels/.github/workflows/linux-pip-tests.yml @@ -4,11 +4,11 @@ on: push: branches: - master - - 2.* + - 3.* pull_request: branches: - master - - 2.* + - 3.* concurrency: group: linux-pip-tests-${{ github.ref }} @@ -24,7 +24,7 @@ jobs: RUNNER_OS: 'ubuntu' USE_CONDA: 'false' strategy: - fail-fast: false + fail-fast: false matrix: PYTHON_VERSION: ['3.8', '3.9', '3.10'] timeout-minutes: 20 @@ -32,16 +32,16 @@ jobs: - name: Checkout branch uses: actions/checkout@v1 - name: Install System Packages - run: | + run: | sudo apt-get update sudo apt-get install libegl1-mesa libopengl0 - name: Install Conda - uses: conda-incubator/setup-miniconda@v2 + uses: conda-incubator/setup-miniconda@v3 with: activate-environment: test auto-update-conda: false auto-activate-base: false - python-version: ${{ matrix.PYTHON_VERSION }} + python-version: ${{ matrix.PYTHON_VERSION }} - name: Install package and dependencies shell: bash -l {0} run: | @@ -61,7 +61,7 @@ jobs: xvfb-run --auto-servernum pytest spyder_kernels --color=yes --cov=spyder_kernels -vv || \ xvfb-run --auto-servernum pytest spyder_kernels --color=yes --cov=spyder_kernels -vv - name: Upload coverage to Codecov - uses: codecov/codecov-action@v3 + uses: codecov/codecov-action@v4 with: fail_ci_if_error: false verbose: true diff --git a/external-deps/spyder-kernels/.github/workflows/linux-tests.yml b/external-deps/spyder-kernels/.github/workflows/linux-tests.yml index 27d2208161e..87381c3e193 100644 --- a/external-deps/spyder-kernels/.github/workflows/linux-tests.yml +++ b/external-deps/spyder-kernels/.github/workflows/linux-tests.yml @@ -4,11 +4,11 @@ on: push: branches: - master - - 2.* + - 3.* pull_request: branches: - master - - 2.* + - 3.* concurrency: group: linux-tests-${{ github.ref }} @@ -24,7 +24,7 @@ jobs: RUNNER_OS: 'ubuntu' USE_CONDA: 'true' strategy: - fail-fast: false + fail-fast: false matrix: PYTHON_VERSION: ['3.8', '3.9', '3.10'] timeout-minutes: 20 @@ -32,25 +32,24 @@ jobs: - name: Checkout branch uses: actions/checkout@v1 - name: Install System Packages - run: | + run: | sudo apt-get update sudo apt-get install libegl1-mesa libopengl0 - name: Install Conda - uses: conda-incubator/setup-miniconda@v2 + uses: conda-incubator/setup-miniconda@v3 with: activate-environment: test auto-update-conda: true auto-activate-base: false channels: conda-forge - miniforge-variant: Mambaforge - python-version: ${{ matrix.PYTHON_VERSION }} + python-version: ${{ matrix.PYTHON_VERSION }} - name: Install package dependencies shell: bash -l {0} run: | - mamba install --file requirements/posix.txt -y -q + conda install --file requirements/posix.txt -y -q - name: Install test dependencies shell: bash -l {0} - run: mamba install --file requirements/tests.txt -y -q + run: conda install --file requirements/tests.txt -y -q - name: Install Package shell: bash -l {0} run: pip install -e . @@ -69,7 +68,7 @@ jobs: xvfb-run --auto-servernum pytest spyder_kernels --color=yes --cov=spyder_kernels -vv || \ xvfb-run --auto-servernum pytest spyder_kernels --color=yes --cov=spyder_kernels -vv - name: Upload coverage to Codecov - uses: codecov/codecov-action@v3 + uses: codecov/codecov-action@v4 with: fail_ci_if_error: false verbose: true diff --git a/external-deps/spyder-kernels/.github/workflows/macos-tests.yml b/external-deps/spyder-kernels/.github/workflows/macos-tests.yml index 98eb2780d63..7b28e9fd38f 100644 --- a/external-deps/spyder-kernels/.github/workflows/macos-tests.yml +++ b/external-deps/spyder-kernels/.github/workflows/macos-tests.yml @@ -4,11 +4,11 @@ on: push: branches: - master - - 2.* + - 3.* pull_request: branches: - master - - 2.* + - 3.* concurrency: group: macos-tests-${{ github.ref }} @@ -24,7 +24,7 @@ jobs: RUNNER_OS: 'macos' USE_CONDA: 'true' strategy: - fail-fast: false + fail-fast: false matrix: PYTHON_VERSION: ['3.8', '3.9', '3.10'] timeout-minutes: 25 @@ -32,21 +32,20 @@ jobs: - name: Checkout branch uses: actions/checkout@v1 - name: Install Conda - uses: conda-incubator/setup-miniconda@v2 + uses: conda-incubator/setup-miniconda@v3 with: activate-environment: test auto-update-conda: true auto-activate-base: false channels: conda-forge - miniforge-variant: Mambaforge - python-version: ${{ matrix.PYTHON_VERSION }} + python-version: ${{ matrix.PYTHON_VERSION }} - name: Install package dependencies shell: bash -l {0} run: | - mamba install --file requirements/posix.txt -y -q + conda install --file requirements/posix.txt -y -q - name: Install test dependencies shell: bash -l {0} - run: mamba install --file requirements/tests.txt -y -q + run: conda install --file requirements/tests.txt -y -q - name: Install Package shell: bash -l {0} run: pip install -e . @@ -65,7 +64,7 @@ jobs: pytest spyder_kernels --color=yes --cov=spyder_kernels -vv || \ pytest spyder_kernels --color=yes --cov=spyder_kernels -vv - name: Upload coverage to Codecov - uses: codecov/codecov-action@v3 + uses: codecov/codecov-action@v4 with: fail_ci_if_error: false verbose: true diff --git a/external-deps/spyder-kernels/.github/workflows/windows-tests.yml b/external-deps/spyder-kernels/.github/workflows/windows-tests.yml index 18afee462d9..ec9d2f16a66 100644 --- a/external-deps/spyder-kernels/.github/workflows/windows-tests.yml +++ b/external-deps/spyder-kernels/.github/workflows/windows-tests.yml @@ -4,11 +4,11 @@ on: push: branches: - master - - 2.* + - 3.* pull_request: branches: - master - - 2.* + - 3.* concurrency: group: windows-tests-${{ github.ref }} @@ -24,7 +24,7 @@ jobs: RUNNER_OS: 'windows' USE_CONDA: 'true' strategy: - fail-fast: false + fail-fast: false matrix: PYTHON_VERSION: ['3.8', '3.9', '3.10'] timeout-minutes: 25 @@ -32,21 +32,20 @@ jobs: - name: Checkout branch uses: actions/checkout@v1 - name: Install Conda - uses: conda-incubator/setup-miniconda@v2 + uses: conda-incubator/setup-miniconda@v3 with: activate-environment: test auto-update-conda: true auto-activate-base: false channels: conda-forge - miniforge-variant: Mambaforge python-version: ${{ matrix.PYTHON_VERSION }} - name: Install package dependencies shell: bash -l {0} - run: mamba install --file requirements/windows.txt -y -q + run: conda install --file requirements/windows.txt -y -q - name: Install test dependencies shell: bash -l {0} run: | - mamba install --file requirements/tests.txt -y -q + conda install --file requirements/tests.txt -y -q - name: Install Package shell: bash -l {0} run: pip install -e . @@ -65,7 +64,7 @@ jobs: pytest spyder_kernels --color=yes --cov=spyder_kernels -vv || \ pytest spyder_kernels --cov=spyder_kernels -vv - name: Upload coverage to Codecov - uses: codecov/codecov-action@v3 + uses: codecov/codecov-action@v4 with: fail_ci_if_error: false verbose: true diff --git a/external-deps/spyder-kernels/.gitrepo b/external-deps/spyder-kernels/.gitrepo index 4c2cd3a6142..ec3f36e84e3 100644 --- a/external-deps/spyder-kernels/.gitrepo +++ b/external-deps/spyder-kernels/.gitrepo @@ -4,9 +4,9 @@ ; git-subrepo command. See https://github.com/ingydotnet/git-subrepo#readme ; [subrepo] - remote = https://github.com/spyder-ide/spyder-kernels.git - branch = master - commit = 1d7201ce887c3d5b167ff2c2944b9c37d193c1c5 - parent = c482cdbd430efd76e4f9d772bd06520e06734db0 + remote = https://github.com/impact27/spyder-kernels.git + branch = fix_loc + commit = b0da61d0fc40ce827543c2414c31a133a5c091ef + parent = 07a915181f157f746433b3fe5b0879f2d32781c4 method = merge - cmdver = 0.4.3 + cmdver = 0.4.9 diff --git a/external-deps/spyder-kernels/README.md b/external-deps/spyder-kernels/README.md index b6307c10e96..3b84dd035b9 100644 --- a/external-deps/spyder-kernels/README.md +++ b/external-deps/spyder-kernels/README.md @@ -64,7 +64,7 @@ PEP257 style guidelines. Spyder and its subprojects are funded thanks to the generous support of -[![Quansight](https://user-images.githubusercontent.com/16781833/142477716-53152d43-99a0-470c-a70b-c04bbfa97dd4.png)](https://www.quansight.com/)[![Numfocus](https://i2.wp.com/numfocus.org/wp-content/uploads/2017/07/NumFocus_LRG.png?fit=320%2C148&ssl=1)](https://numfocus.org/) +[![Chan Zuckerberg Initiative](https://raw.githubusercontent.com/spyder-ide/spyder/master/img_src/czi.png)](https://chanzuckerberg.com/)[![Numfocus](https://i2.wp.com/numfocus.org/wp-content/uploads/2017/07/NumFocus_LRG.png?fit=320%2C148&ssl=1)](https://numfocus.org/) and the donations we have received from our users around the world through [Open Collective](https://opencollective.com/spyder/): diff --git a/external-deps/spyder-kernels/spyder_kernels/customize/code_runner.py b/external-deps/spyder-kernels/spyder_kernels/customize/code_runner.py index d3cc7a1f485..9917abb9999 100644 --- a/external-deps/spyder-kernels/spyder_kernels/customize/code_runner.py +++ b/external-deps/spyder-kernels/spyder_kernels/customize/code_runner.py @@ -247,7 +247,7 @@ def _debugger_exec(self, filename, continue_if_has_breakpoints): debugger.set_remote_filename(filename) debugger.continue_if_has_breakpoints = continue_if_has_breakpoints - def debug_exec(code, glob, loc): + def debug_exec(code, glob=None, loc=None): return sys.call_tracing(debugger.run, (code, glob, loc)) # Enter recursive debugger diff --git a/external-deps/spyder-kernels/spyder_kernels/customize/utils.py b/external-deps/spyder-kernels/spyder_kernels/customize/utils.py index fff18581b2c..23e3c37e0f1 100644 --- a/external-deps/spyder-kernels/spyder_kernels/customize/utils.py +++ b/external-deps/spyder-kernels/spyder_kernels/customize/utils.py @@ -206,7 +206,7 @@ def exec_encapsulate_locals( exec_fun = exec if filename is None: filename = "" - exec_fun(compile(code_ast, filename, "exec"), globals) + exec_fun(compile(code_ast, filename, "exec"), globals, None) finally: if use_locals_hack: # Cleanup code diff --git a/external-deps/spyder-kernels/spyder_kernels/utils/iofuncs.py b/external-deps/spyder-kernels/spyder_kernels/utils/iofuncs.py index 7da2828ff3a..5102d4a49d4 100644 --- a/external-deps/spyder-kernels/spyder_kernels/utils/iofuncs.py +++ b/external-deps/spyder-kernels/spyder_kernels/utils/iofuncs.py @@ -506,9 +506,16 @@ def load_dicom(filename): name = osp.splitext(osp.basename(filename))[0] try: - data = dicomio.read_file(filename, force=True) + # For Pydicom 3/Python 3.10+ + data = dicomio.dcmread(filename, force=True) except TypeError: - data = dicomio.read_file(filename) + data = dicomio.dcmread(filename) + except AttributeError: + # For Pydicom 2/Python 3.9- + try: + data = dicomio.read_file(filename, force=True) + except TypeError: + data = dicomio.read_file(filename) arr = data.pixel_array return {name: arr}, None except Exception as error: diff --git a/external-deps/spyder-kernels/spyder_kernels/utils/tests/test_iofuncs.py b/external-deps/spyder-kernels/spyder_kernels/utils/tests/test_iofuncs.py index d88b2e103d5..ee8c1b1bbcc 100644 --- a/external-deps/spyder-kernels/spyder_kernels/utils/tests/test_iofuncs.py +++ b/external-deps/spyder-kernels/spyder_kernels/utils/tests/test_iofuncs.py @@ -11,9 +11,9 @@ """ # Standard library imports +import copy import io import os -import copy # Third party imports from PIL import ImageFile @@ -350,6 +350,10 @@ def test_save_load_hdf5_files(tmp_path): assert repr(iofuncs.load_hdf5(h5_file)) == repr(expected) +@pytest.mark.skipif( + os.environ.get("USE_CONDA") == "true", + reason="Pydicom is not installed correctly in Conda envs" +) def test_load_dicom_files(): """Check that we can load DICOM files.""" # This test pass locally but we need to set the variable below for it to From 3852ec47717cd061a2b9719501a5b5e1f9571f18 Mon Sep 17 00:00:00 2001 From: Carlos Cordoba Date: Thu, 3 Oct 2024 23:03:19 -0500 Subject: [PATCH 06/10] Testing: Check that pdb magics start a recursive debugger --- .../plugins/ipythonconsole/tests/conftest.py | 38 ++++++++++++++++-- .../tests/test_ipythonconsole.py | 39 +++++++++++++++++++ 2 files changed, 74 insertions(+), 3 deletions(-) diff --git a/spyder/plugins/ipythonconsole/tests/conftest.py b/spyder/plugins/ipythonconsole/tests/conftest.py index dcae4b351f4..65134d3d8fa 100644 --- a/spyder/plugins/ipythonconsole/tests/conftest.py +++ b/spyder/plugins/ipythonconsole/tests/conftest.py @@ -8,6 +8,7 @@ # Standard library imports import os import os.path as osp +from pathlib import Path import sys import threading import traceback @@ -203,9 +204,39 @@ def get_plugin(name): debugger.get_plugin = get_plugin debugger.on_ipython_console_available() + + # Plugin setup console.on_initialize() console._register() console.get_widget().matplotlib_status.register_ipythonconsole(console) + + # Register handlers to run cells. + def get_file_code(fname, save_all=True): + """ + Get code from a file. + + save_all is necessary to keep consistency with the handler registered + in the editor. + """ + path = Path(fname) + return path.read_text() + + def get_cell(cell_id, fname): + """ + Get cell code from a file. + + For now this only works with unnamed cells and cell separators of the + form `# %%`. + """ + path = Path(fname) + contents = path.read_text() + cells = contents.split("# %%") + return cells[int(cell_id)] + + console.register_spyder_kernel_call_handler('get_file_code', get_file_code) + console.register_spyder_kernel_call_handler('run_cell', get_cell) + + # Start client and show window console.create_new_client( special=special, given_name=given_name, @@ -213,9 +244,6 @@ def get_plugin(name): ) window.setCentralWidget(console.get_widget()) - # Set exclamation mark to True - configuration.set('debugger', 'pdb_use_exclamation_mark', True) - if os.name == 'nt': qtbot.addWidget(window) @@ -223,6 +251,10 @@ def get_plugin(name): window.resize(640, 480) window.show() + # Set exclamation mark to True + configuration.set('debugger', 'pdb_use_exclamation_mark', True) + + # Create new client for Matplotlb backend tests if auto_backend or tk_backend: qtbot.wait(SHELL_TIMEOUT) console.create_new_client() diff --git a/spyder/plugins/ipythonconsole/tests/test_ipythonconsole.py b/spyder/plugins/ipythonconsole/tests/test_ipythonconsole.py index 931d196c2f1..e139e512eff 100644 --- a/spyder/plugins/ipythonconsole/tests/test_ipythonconsole.py +++ b/spyder/plugins/ipythonconsole/tests/test_ipythonconsole.py @@ -1656,6 +1656,45 @@ def test_recursive_pdb(ipyconsole, qtbot): assert control.toPlainText().split()[-2:] == ["In", "[3]:"] +def test_pdb_magics_are_recursive(ipyconsole, qtbot, tmp_path): + """ + Check that calls to Pdb magics start a recursive debugger when called in + a debugging session. + """ + shell = ipyconsole.get_current_shellwidget() + control = ipyconsole.get_widget().get_focus_widget() + + # Code to run + code = "a = 10\n\n# %%\n\nb = 20" + + # Write code to file on disk + file = tmp_path / 'test_pdb_magics.py' + file.write_text(code) + + # Filename in the format used when running magics from the main toolbar + fname = str(file).replace('\\', '/') + + # Run file + with qtbot.waitSignal(shell.executed): + shell.execute(f"%debugfile {fname}") + + # Run %debugfile in debugger + with qtbot.waitSignal(shell.executed): + shell.pdb_execute(f"%debugfile {fname}") + + # Check that there are no errors and we started a recursive debugger + assert "error" not in control.toPlainText().lower() + assert "(IPdb [1]):" in control.toPlainText() + + # Run %debugcell in debugger + with qtbot.waitSignal(shell.executed): + shell.pdb_execute(f"%debugcell -i 0 {fname}") + + # Check that there are no errors and we started a recursive debugger + assert "error" not in control.toPlainText().lower() + assert "((IPdb [1])):" in control.toPlainText() + + @flaky(max_runs=3) @pytest.mark.skipif(os.name == 'nt', reason="Doesn't work on windows") def test_stop_pdb(ipyconsole, qtbot): From ba28ce2ac0c205e33bd1148dd9645261bb830702 Mon Sep 17 00:00:00 2001 From: Carlos Cordoba Date: Sun, 6 Oct 2024 13:14:18 -0500 Subject: [PATCH 07/10] git subrepo pull --remote=https://github.com/ccordoba12/spyder-kernels.git --branch=fix-version --update --force external-deps/spyder-kernels subrepo: subdir: "external-deps/spyder-kernels" merged: "c59dbf3c1b" upstream: origin: "https://github.com/ccordoba12/spyder-kernels.git" branch: "fix-version" commit: "c59dbf3c1b" git-subrepo: version: "0.4.9" origin: "https://github.com/ingydotnet/git-subrepo" commit: "ea10886" --- .../.github/workflows/linux-pip-tests.yml | 14 +++++++------- .../.github/workflows/linux-tests.yml | 19 +++++++++---------- .../.github/workflows/macos-tests.yml | 17 ++++++++--------- .../.github/workflows/windows-tests.yml | 15 +++++++-------- external-deps/spyder-kernels/.gitrepo | 10 +++++----- external-deps/spyder-kernels/README.md | 2 +- .../spyder-kernels/spyder_kernels/_version.py | 2 +- .../spyder_kernels/utils/iofuncs.py | 11 +++++++++-- .../utils/tests/test_iofuncs.py | 6 +++++- 9 files changed, 52 insertions(+), 44 deletions(-) diff --git a/external-deps/spyder-kernels/.github/workflows/linux-pip-tests.yml b/external-deps/spyder-kernels/.github/workflows/linux-pip-tests.yml index e8d0de90241..1a4f1e5a67e 100644 --- a/external-deps/spyder-kernels/.github/workflows/linux-pip-tests.yml +++ b/external-deps/spyder-kernels/.github/workflows/linux-pip-tests.yml @@ -4,11 +4,11 @@ on: push: branches: - master - - 2.* + - 3.* pull_request: branches: - master - - 2.* + - 3.* concurrency: group: linux-pip-tests-${{ github.ref }} @@ -24,7 +24,7 @@ jobs: RUNNER_OS: 'ubuntu' USE_CONDA: 'false' strategy: - fail-fast: false + fail-fast: false matrix: PYTHON_VERSION: ['3.8', '3.9', '3.10'] timeout-minutes: 20 @@ -32,16 +32,16 @@ jobs: - name: Checkout branch uses: actions/checkout@v1 - name: Install System Packages - run: | + run: | sudo apt-get update sudo apt-get install libegl1-mesa libopengl0 - name: Install Conda - uses: conda-incubator/setup-miniconda@v2 + uses: conda-incubator/setup-miniconda@v3 with: activate-environment: test auto-update-conda: false auto-activate-base: false - python-version: ${{ matrix.PYTHON_VERSION }} + python-version: ${{ matrix.PYTHON_VERSION }} - name: Install package and dependencies shell: bash -l {0} run: | @@ -61,7 +61,7 @@ jobs: xvfb-run --auto-servernum pytest spyder_kernels --color=yes --cov=spyder_kernels -vv || \ xvfb-run --auto-servernum pytest spyder_kernels --color=yes --cov=spyder_kernels -vv - name: Upload coverage to Codecov - uses: codecov/codecov-action@v3 + uses: codecov/codecov-action@v4 with: fail_ci_if_error: false verbose: true diff --git a/external-deps/spyder-kernels/.github/workflows/linux-tests.yml b/external-deps/spyder-kernels/.github/workflows/linux-tests.yml index 27d2208161e..87381c3e193 100644 --- a/external-deps/spyder-kernels/.github/workflows/linux-tests.yml +++ b/external-deps/spyder-kernels/.github/workflows/linux-tests.yml @@ -4,11 +4,11 @@ on: push: branches: - master - - 2.* + - 3.* pull_request: branches: - master - - 2.* + - 3.* concurrency: group: linux-tests-${{ github.ref }} @@ -24,7 +24,7 @@ jobs: RUNNER_OS: 'ubuntu' USE_CONDA: 'true' strategy: - fail-fast: false + fail-fast: false matrix: PYTHON_VERSION: ['3.8', '3.9', '3.10'] timeout-minutes: 20 @@ -32,25 +32,24 @@ jobs: - name: Checkout branch uses: actions/checkout@v1 - name: Install System Packages - run: | + run: | sudo apt-get update sudo apt-get install libegl1-mesa libopengl0 - name: Install Conda - uses: conda-incubator/setup-miniconda@v2 + uses: conda-incubator/setup-miniconda@v3 with: activate-environment: test auto-update-conda: true auto-activate-base: false channels: conda-forge - miniforge-variant: Mambaforge - python-version: ${{ matrix.PYTHON_VERSION }} + python-version: ${{ matrix.PYTHON_VERSION }} - name: Install package dependencies shell: bash -l {0} run: | - mamba install --file requirements/posix.txt -y -q + conda install --file requirements/posix.txt -y -q - name: Install test dependencies shell: bash -l {0} - run: mamba install --file requirements/tests.txt -y -q + run: conda install --file requirements/tests.txt -y -q - name: Install Package shell: bash -l {0} run: pip install -e . @@ -69,7 +68,7 @@ jobs: xvfb-run --auto-servernum pytest spyder_kernels --color=yes --cov=spyder_kernels -vv || \ xvfb-run --auto-servernum pytest spyder_kernels --color=yes --cov=spyder_kernels -vv - name: Upload coverage to Codecov - uses: codecov/codecov-action@v3 + uses: codecov/codecov-action@v4 with: fail_ci_if_error: false verbose: true diff --git a/external-deps/spyder-kernels/.github/workflows/macos-tests.yml b/external-deps/spyder-kernels/.github/workflows/macos-tests.yml index 98eb2780d63..7b28e9fd38f 100644 --- a/external-deps/spyder-kernels/.github/workflows/macos-tests.yml +++ b/external-deps/spyder-kernels/.github/workflows/macos-tests.yml @@ -4,11 +4,11 @@ on: push: branches: - master - - 2.* + - 3.* pull_request: branches: - master - - 2.* + - 3.* concurrency: group: macos-tests-${{ github.ref }} @@ -24,7 +24,7 @@ jobs: RUNNER_OS: 'macos' USE_CONDA: 'true' strategy: - fail-fast: false + fail-fast: false matrix: PYTHON_VERSION: ['3.8', '3.9', '3.10'] timeout-minutes: 25 @@ -32,21 +32,20 @@ jobs: - name: Checkout branch uses: actions/checkout@v1 - name: Install Conda - uses: conda-incubator/setup-miniconda@v2 + uses: conda-incubator/setup-miniconda@v3 with: activate-environment: test auto-update-conda: true auto-activate-base: false channels: conda-forge - miniforge-variant: Mambaforge - python-version: ${{ matrix.PYTHON_VERSION }} + python-version: ${{ matrix.PYTHON_VERSION }} - name: Install package dependencies shell: bash -l {0} run: | - mamba install --file requirements/posix.txt -y -q + conda install --file requirements/posix.txt -y -q - name: Install test dependencies shell: bash -l {0} - run: mamba install --file requirements/tests.txt -y -q + run: conda install --file requirements/tests.txt -y -q - name: Install Package shell: bash -l {0} run: pip install -e . @@ -65,7 +64,7 @@ jobs: pytest spyder_kernels --color=yes --cov=spyder_kernels -vv || \ pytest spyder_kernels --color=yes --cov=spyder_kernels -vv - name: Upload coverage to Codecov - uses: codecov/codecov-action@v3 + uses: codecov/codecov-action@v4 with: fail_ci_if_error: false verbose: true diff --git a/external-deps/spyder-kernels/.github/workflows/windows-tests.yml b/external-deps/spyder-kernels/.github/workflows/windows-tests.yml index 18afee462d9..ec9d2f16a66 100644 --- a/external-deps/spyder-kernels/.github/workflows/windows-tests.yml +++ b/external-deps/spyder-kernels/.github/workflows/windows-tests.yml @@ -4,11 +4,11 @@ on: push: branches: - master - - 2.* + - 3.* pull_request: branches: - master - - 2.* + - 3.* concurrency: group: windows-tests-${{ github.ref }} @@ -24,7 +24,7 @@ jobs: RUNNER_OS: 'windows' USE_CONDA: 'true' strategy: - fail-fast: false + fail-fast: false matrix: PYTHON_VERSION: ['3.8', '3.9', '3.10'] timeout-minutes: 25 @@ -32,21 +32,20 @@ jobs: - name: Checkout branch uses: actions/checkout@v1 - name: Install Conda - uses: conda-incubator/setup-miniconda@v2 + uses: conda-incubator/setup-miniconda@v3 with: activate-environment: test auto-update-conda: true auto-activate-base: false channels: conda-forge - miniforge-variant: Mambaforge python-version: ${{ matrix.PYTHON_VERSION }} - name: Install package dependencies shell: bash -l {0} - run: mamba install --file requirements/windows.txt -y -q + run: conda install --file requirements/windows.txt -y -q - name: Install test dependencies shell: bash -l {0} run: | - mamba install --file requirements/tests.txt -y -q + conda install --file requirements/tests.txt -y -q - name: Install Package shell: bash -l {0} run: pip install -e . @@ -65,7 +64,7 @@ jobs: pytest spyder_kernels --color=yes --cov=spyder_kernels -vv || \ pytest spyder_kernels --cov=spyder_kernels -vv - name: Upload coverage to Codecov - uses: codecov/codecov-action@v3 + uses: codecov/codecov-action@v4 with: fail_ci_if_error: false verbose: true diff --git a/external-deps/spyder-kernels/.gitrepo b/external-deps/spyder-kernels/.gitrepo index 4c2cd3a6142..6767f16e8c6 100644 --- a/external-deps/spyder-kernels/.gitrepo +++ b/external-deps/spyder-kernels/.gitrepo @@ -4,9 +4,9 @@ ; git-subrepo command. See https://github.com/ingydotnet/git-subrepo#readme ; [subrepo] - remote = https://github.com/spyder-ide/spyder-kernels.git - branch = master - commit = 1d7201ce887c3d5b167ff2c2944b9c37d193c1c5 - parent = c482cdbd430efd76e4f9d772bd06520e06734db0 + remote = https://github.com/ccordoba12/spyder-kernels.git + branch = fix-version + commit = c59dbf3c1b752f28b285c15e3573727840354106 + parent = 07a915181f157f746433b3fe5b0879f2d32781c4 method = merge - cmdver = 0.4.3 + cmdver = 0.4.9 diff --git a/external-deps/spyder-kernels/README.md b/external-deps/spyder-kernels/README.md index b6307c10e96..3b84dd035b9 100644 --- a/external-deps/spyder-kernels/README.md +++ b/external-deps/spyder-kernels/README.md @@ -64,7 +64,7 @@ PEP257 style guidelines. Spyder and its subprojects are funded thanks to the generous support of -[![Quansight](https://user-images.githubusercontent.com/16781833/142477716-53152d43-99a0-470c-a70b-c04bbfa97dd4.png)](https://www.quansight.com/)[![Numfocus](https://i2.wp.com/numfocus.org/wp-content/uploads/2017/07/NumFocus_LRG.png?fit=320%2C148&ssl=1)](https://numfocus.org/) +[![Chan Zuckerberg Initiative](https://raw.githubusercontent.com/spyder-ide/spyder/master/img_src/czi.png)](https://chanzuckerberg.com/)[![Numfocus](https://i2.wp.com/numfocus.org/wp-content/uploads/2017/07/NumFocus_LRG.png?fit=320%2C148&ssl=1)](https://numfocus.org/) and the donations we have received from our users around the world through [Open Collective](https://opencollective.com/spyder/): diff --git a/external-deps/spyder-kernels/spyder_kernels/_version.py b/external-deps/spyder-kernels/spyder_kernels/_version.py index 1d3a5157c94..2d20379b9d0 100644 --- a/external-deps/spyder-kernels/spyder_kernels/_version.py +++ b/external-deps/spyder-kernels/spyder_kernels/_version.py @@ -8,5 +8,5 @@ """Version File.""" -VERSION_INFO = (4, 0, 0, 'dev0') +VERSION_INFO = (3, 1, 0, 'dev0') __version__ = '.'.join(map(str, VERSION_INFO)) diff --git a/external-deps/spyder-kernels/spyder_kernels/utils/iofuncs.py b/external-deps/spyder-kernels/spyder_kernels/utils/iofuncs.py index 7da2828ff3a..5102d4a49d4 100644 --- a/external-deps/spyder-kernels/spyder_kernels/utils/iofuncs.py +++ b/external-deps/spyder-kernels/spyder_kernels/utils/iofuncs.py @@ -506,9 +506,16 @@ def load_dicom(filename): name = osp.splitext(osp.basename(filename))[0] try: - data = dicomio.read_file(filename, force=True) + # For Pydicom 3/Python 3.10+ + data = dicomio.dcmread(filename, force=True) except TypeError: - data = dicomio.read_file(filename) + data = dicomio.dcmread(filename) + except AttributeError: + # For Pydicom 2/Python 3.9- + try: + data = dicomio.read_file(filename, force=True) + except TypeError: + data = dicomio.read_file(filename) arr = data.pixel_array return {name: arr}, None except Exception as error: diff --git a/external-deps/spyder-kernels/spyder_kernels/utils/tests/test_iofuncs.py b/external-deps/spyder-kernels/spyder_kernels/utils/tests/test_iofuncs.py index d88b2e103d5..ee8c1b1bbcc 100644 --- a/external-deps/spyder-kernels/spyder_kernels/utils/tests/test_iofuncs.py +++ b/external-deps/spyder-kernels/spyder_kernels/utils/tests/test_iofuncs.py @@ -11,9 +11,9 @@ """ # Standard library imports +import copy import io import os -import copy # Third party imports from PIL import ImageFile @@ -350,6 +350,10 @@ def test_save_load_hdf5_files(tmp_path): assert repr(iofuncs.load_hdf5(h5_file)) == repr(expected) +@pytest.mark.skipif( + os.environ.get("USE_CONDA") == "true", + reason="Pydicom is not installed correctly in Conda envs" +) def test_load_dicom_files(): """Check that we can load DICOM files.""" # This test pass locally but we need to set the variable below for it to From 6684ca2135710b5002365979c84b42ac6ce34305 Mon Sep 17 00:00:00 2001 From: Carlos Cordoba Date: Sun, 6 Oct 2024 13:21:19 -0500 Subject: [PATCH 08/10] IPython console: Simplify min/max required versions of spyder-kernels - We can do this because we now use a better dev version in the spyder-kernels master branch. - Also, change its max requirement in all places it's set. --- binder/environment.yml | 2 +- requirements/main.yml | 2 +- setup.py | 3 +-- spyder/dependencies.py | 2 +- spyder/plugins/ipythonconsole/__init__.py | 10 +++------- 5 files changed, 7 insertions(+), 12 deletions(-) diff --git a/binder/environment.yml b/binder/environment.yml index d4c3e6898aa..e484bf0b707 100644 --- a/binder/environment.yml +++ b/binder/environment.yml @@ -50,7 +50,7 @@ dependencies: - rtree >=0.9.7 - setuptools >=49.6.0 - sphinx >=0.6.6 -- spyder-kernels >=3.0.0,<3.1.0 +- spyder-kernels >=3.0.0,<3.2.0 - superqt >=0.6.2,<1.0.0 - textdistance >=4.2.0 - three-merge >=0.1.1 diff --git a/requirements/main.yml b/requirements/main.yml index d1caab3a784..4466f3d8a03 100644 --- a/requirements/main.yml +++ b/requirements/main.yml @@ -47,7 +47,7 @@ dependencies: - rtree >=0.9.7 - setuptools >=49.6.0 - sphinx >=0.6.6 - - spyder-kernels >=3.0.0,<3.1.0 + - spyder-kernels >=3.0.0,<3.2.0 - superqt >=0.6.2,<1.0.0 - textdistance >=4.2.0 - three-merge >=0.1.1 diff --git a/setup.py b/setup.py index 9e8fdabf95d..9f39803f8a0 100644 --- a/setup.py +++ b/setup.py @@ -247,7 +247,7 @@ def run(self): 'rtree>=0.9.7', 'setuptools>=49.6.0', 'sphinx>=0.6.6', - 'spyder-kernels>=3.0.0,<3.1.0', + 'spyder-kernels>=3.0.0,<3.2.0', 'superqt>=0.6.2,<1.0.0', 'textdistance>=4.2.0', 'three-merge>=0.1.1', @@ -262,7 +262,6 @@ def run(self): if req.split(">")[0] not in reqs_to_loosen] install_requires.append('python-lsp-server[all]>=1.12.0,<1.14.0') install_requires.append('qtconsole>=5.5.1,<5.7.0') - install_requires.append('spyder-kernels>=3.0.0,<3.2.0') extras_require = { 'test:platform_system == "Windows"': ['pywin32'], diff --git a/spyder/dependencies.py b/spyder/dependencies.py index 39897157d64..b3e7d371504 100644 --- a/spyder/dependencies.py +++ b/spyder/dependencies.py @@ -73,7 +73,7 @@ RTREE_REQVER = '>=0.9.7' SETUPTOOLS_REQVER = '>=49.6.0' SPHINX_REQVER = '>=0.6.6' -SPYDER_KERNELS_REQVER = '>=3.0.0,<3.1.0' +SPYDER_KERNELS_REQVER = '>=3.0.0,<3.2.0' SUPERQT_REQVER = '>=0.6.2,<1.0.0' TEXTDISTANCE_REQVER = '>=4.2.0' THREE_MERGE_REQVER = '>=0.1.1' diff --git a/spyder/plugins/ipythonconsole/__init__.py b/spyder/plugins/ipythonconsole/__init__.py index 60d63447d0c..5eb39ecdf83 100644 --- a/spyder/plugins/ipythonconsole/__init__.py +++ b/spyder/plugins/ipythonconsole/__init__.py @@ -11,7 +11,7 @@ IPython Console plugin based on QtConsole """ -from spyder.config.base import is_stable_version, running_under_pytest +from spyder.config.base import is_stable_version # Use this variable, which corresponds to the html dash symbol, for any command # that requires a dash below. That way users will be able to copy/paste @@ -19,12 +19,8 @@ _d = '-' # Required version of Spyder-kernels -SPYDER_KERNELS_MIN_VERSION = ( - '3.0.0' if not running_under_pytest() else '3.1.0.dev0' -) -SPYDER_KERNELS_MAX_VERSION = ( - '3.1.0' if not running_under_pytest() else '4.0.0' -) +SPYDER_KERNELS_MIN_VERSION = '3.1.0.dev0' +SPYDER_KERNELS_MAX_VERSION = '3.2.0' SPYDER_KERNELS_VERSION = ( f'>={SPYDER_KERNELS_MIN_VERSION},<{SPYDER_KERNELS_MAX_VERSION}' ) From 8af8aff22f325e6fc4290258f13344c93ff77b05 Mon Sep 17 00:00:00 2001 From: Carlos Cordoba Date: Sun, 6 Oct 2024 18:01:20 -0500 Subject: [PATCH 09/10] git subrepo pull (merge) --remote=https://github.com/spyder-ide/spyder-kernels.git --branch=master --update --force external-deps/spyder-kernels subrepo: subdir: "external-deps/spyder-kernels" merged: "afdcd9f055" upstream: origin: "https://github.com/spyder-ide/spyder-kernels.git" branch: "master" commit: "afdcd9f055" git-subrepo: version: "0.4.9" origin: "https://github.com/ingydotnet/git-subrepo" commit: "ea10886" [ci skip] --- external-deps/spyder-kernels/.gitrepo | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/external-deps/spyder-kernels/.gitrepo b/external-deps/spyder-kernels/.gitrepo index 6767f16e8c6..c0883e585fd 100644 --- a/external-deps/spyder-kernels/.gitrepo +++ b/external-deps/spyder-kernels/.gitrepo @@ -4,9 +4,9 @@ ; git-subrepo command. See https://github.com/ingydotnet/git-subrepo#readme ; [subrepo] - remote = https://github.com/ccordoba12/spyder-kernels.git - branch = fix-version - commit = c59dbf3c1b752f28b285c15e3573727840354106 - parent = 07a915181f157f746433b3fe5b0879f2d32781c4 + remote = https://github.com/spyder-ide/spyder-kernels.git + branch = master + commit = afdcd9f05559b8d702f653e5b5cdc2c8fa2762cd + parent = 6684ca2135710b5002365979c84b42ac6ce34305 method = merge cmdver = 0.4.9 From f3685695e3a57e0a75e4965f2cfe698c2b46a6d3 Mon Sep 17 00:00:00 2001 From: Carlos Cordoba Date: Sun, 6 Oct 2024 19:14:38 -0500 Subject: [PATCH 10/10] git subrepo pull (merge) --remote=https://github.com/spyder-ide/spyder-kernels.git --branch=master --update --force external-deps/spyder-kernels subrepo: subdir: "external-deps/spyder-kernels" merged: "7056185961" upstream: origin: "https://github.com/spyder-ide/spyder-kernels.git" branch: "master" commit: "7056185961" git-subrepo: version: "0.4.9" origin: "https://github.com/ingydotnet/git-subrepo" commit: "ea10886" --- external-deps/spyder-kernels/.gitrepo | 8 ++++---- external-deps/spyder-kernels/spyder_kernels/_version.py | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/external-deps/spyder-kernels/.gitrepo b/external-deps/spyder-kernels/.gitrepo index ec3f36e84e3..f726b52bc9f 100644 --- a/external-deps/spyder-kernels/.gitrepo +++ b/external-deps/spyder-kernels/.gitrepo @@ -4,9 +4,9 @@ ; git-subrepo command. See https://github.com/ingydotnet/git-subrepo#readme ; [subrepo] - remote = https://github.com/impact27/spyder-kernels.git - branch = fix_loc - commit = b0da61d0fc40ce827543c2414c31a133a5c091ef - parent = 07a915181f157f746433b3fe5b0879f2d32781c4 + remote = https://github.com/spyder-ide/spyder-kernels.git + branch = master + commit = 705618596160a1d65a7a0fc71cec1cfc41fbcaeb + parent = 3852ec47717cd061a2b9719501a5b5e1f9571f18 method = merge cmdver = 0.4.9 diff --git a/external-deps/spyder-kernels/spyder_kernels/_version.py b/external-deps/spyder-kernels/spyder_kernels/_version.py index 1d3a5157c94..2d20379b9d0 100644 --- a/external-deps/spyder-kernels/spyder_kernels/_version.py +++ b/external-deps/spyder-kernels/spyder_kernels/_version.py @@ -8,5 +8,5 @@ """Version File.""" -VERSION_INFO = (4, 0, 0, 'dev0') +VERSION_INFO = (3, 1, 0, 'dev0') __version__ = '.'.join(map(str, VERSION_INFO))