From 12dd0eb0233bcfb9028a547b2367c3ddbee5a673 Mon Sep 17 00:00:00 2001 From: Alexander Goscinski Date: Thu, 27 Jun 2024 23:46:18 +0200 Subject: [PATCH 1/5] Update formatting to black 24 --- src/scwidgets/check/_widget_check_registry.py | 6 +++--- src/scwidgets/exercise/_widget_code_exercise.py | 8 +++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/scwidgets/check/_widget_check_registry.py b/src/scwidgets/check/_widget_check_registry.py index 582239a..ccdba22 100644 --- a/src/scwidgets/check/_widget_check_registry.py +++ b/src/scwidgets/check/_widget_check_registry.py @@ -250,9 +250,9 @@ def check_widget(self, widget: CheckableWidget) -> Union[ChecksResult, Exception def check_all_widgets( self, ) -> OrderedDict[CheckableWidget, Union[ChecksResult, Exception]]: - messages: OrderedDict[ - CheckableWidget, Union[ChecksResult, Exception] - ] = OrderedDict() + messages: OrderedDict[CheckableWidget, Union[ChecksResult, Exception]] = ( + OrderedDict() + ) for widget in self._checks.keys(): try: messages[widget] = self.check_widget(widget) diff --git a/src/scwidgets/exercise/_widget_code_exercise.py b/src/scwidgets/exercise/_widget_code_exercise.py index 79dd625..17283a0 100644 --- a/src/scwidgets/exercise/_widget_code_exercise.py +++ b/src/scwidgets/exercise/_widget_code_exercise.py @@ -445,9 +445,11 @@ def __init__( def answer(self) -> dict: return { "code": None if self._code is None else self._code.function_body, - "parameter_panel": None - if self._parameter_panel is None - else self._parameter_panel.parameters, + "parameter_panel": ( + None + if self._parameter_panel is None + else self._parameter_panel.parameters + ), } @answer.setter From 78e464e1514c300066ab51cee6498951efa2dc15 Mon Sep 17 00:00:00 2001 From: Alexander Goscinski Date: Thu, 27 Jun 2024 23:50:25 +0200 Subject: [PATCH 2/5] Pin numpy version to < 2.0.0 numpy 2.0.0 API causes the assert tests to fail. To temporary fix this we pin numpy to < 2.0.0. We will solve this in a dedicated PR. See issue https://github.com/osscar-org/scicode-widgets/issues/48 --- pyproject.toml | 2 +- tox.ini | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index ff9c04c..db2f468 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -29,7 +29,7 @@ classifiers = [ ] dependencies = [ "ipywidgets>=8.0.0", - "numpy", + "numpy<2.0.0", "widget_code_input", "matplotlib", "termcolor" diff --git a/tox.ini b/tox.ini index bedf882..4256ae2 100644 --- a/tox.ini +++ b/tox.ini @@ -35,7 +35,7 @@ deps = imageio # we fix matplotlib for consistent image tests matplotlib==3.7.2 - numpy + numpy<2.0.0 scikit-image ipympl commands = @@ -67,7 +67,7 @@ deps = imageio # we fix matplotlib for consistent image tests matplotlib==3.7.2 - numpy + numpy<2.0.0 scikit-image ipympl commands = From 5adea084098d6ff78e2ad1c4ea2160105329aa3d Mon Sep 17 00:00:00 2001 From: Alexander Goscinski Date: Fri, 28 Jun 2024 00:11:07 +0200 Subject: [PATCH 3/5] Pin pytest to < 8.0.0 A temporary fix for the failure of the selenium tests. See issue https://github.com/osscar-org/scicode-widgets/issues/47 --- tox.ini | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tox.ini b/tox.ini index 4256ae2..08b4c2c 100644 --- a/tox.ini +++ b/tox.ini @@ -23,7 +23,7 @@ setenv = JUPYTER_CONFIG_DIR={envdir}/etc/jupyter JUPYTER_DATA_DIR={envdir}/share/jupyter deps = - pytest + pytest<8.0.0 pytest-html<4.0.0, # selenium juypter notebook tests notebook==7.0.2 @@ -55,7 +55,7 @@ setenv = JUPYTER_CONFIG_DIR={envdir}/etc/jupyter JUPYTER_DATA_DIR={envdir}/share/jupyter deps = - pytest + pytest<8.0.0 pytest-html<4.0.0, # selenium juypter notebook tests jupyterlab==3.6.5 @@ -80,7 +80,7 @@ commands = # includes the jupytext notebook files, because coverage is incompatible with # selenium deps = - pytest + pytest<8.0.0 pytest-cov coverage[toml] selenium==4.9.0 From 2c03ef787dea0e572ae72f00d8a174947f5d17b0 Mon Sep 17 00:00:00 2001 From: Alexander Goscinski Date: Fri, 28 Jun 2024 09:57:00 +0200 Subject: [PATCH 4/5] Pin widget_code_input < 4.0.0 The new widget_code_input introudces completely style of the WidgetCodeInput that introduces the widgets tests to fail. We will upgrade to widget_code_input 4 in a dedicated PR. See PR #45. --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index db2f468..a4da607 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -30,7 +30,7 @@ classifiers = [ dependencies = [ "ipywidgets>=8.0.0", "numpy<2.0.0", - "widget_code_input", + "widget_code_input<4.0.0", "matplotlib", "termcolor" ] From 72d4d478bfc80d335d8a7ed8dda1809eb587651d Mon Sep 17 00:00:00 2001 From: Alexander Goscinski Date: Mon, 1 Jul 2024 22:38:26 +0200 Subject: [PATCH 5/5] Drop notebook 7 tests The new version updates have made the notebook 7 tests unfeasible to further maintain. See issues #49 and #50. --- .github/workflows/tests-notebook-7.yml | 38 -------------------------- tox.ini | 32 ---------------------- 2 files changed, 70 deletions(-) delete mode 100644 .github/workflows/tests-notebook-7.yml diff --git a/.github/workflows/tests-notebook-7.yml b/.github/workflows/tests-notebook-7.yml deleted file mode 100644 index 82c88e9..0000000 --- a/.github/workflows/tests-notebook-7.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: Tests - notebook 7 - -on: - push: - branches: [main] - pull_request: - # Check all PR - -jobs: - tests: - runs-on: ${{ matrix.os }} - strategy: - matrix: - include: - - os: ubuntu-22.04 - python-version: "3.11" - - steps: - - uses: actions/checkout@v3 - - name: Install Firefox - uses: browser-actions/setup-firefox@latest - - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - run: pip install tox - - - name: run Python tests - run: tox -e tests-notebook-7 - - - name: run Python tests for coverage - run: tox -e coverage - - uses: codecov/codecov-action@v3 - with: - files: coverage.xml - verbose: true - diff --git a/tox.ini b/tox.ini index 08b4c2c..a4f101c 100644 --- a/tox.ini +++ b/tox.ini @@ -11,38 +11,6 @@ envlist = [testenv] -[testenv:tests-notebook-7] -description = - Tests with jupyter notebook version > 7 -setenv = - # this is needed to run selenium on a machine without display to do CI - SELENIUM_FIREFOX_DRIVER_ARGS = {env:SELENIUM_FIREFOX_DRIVER_ARGS:--headless} - JUPYTER_TYPE = notebook - # use the jupyter config in the tox environment - # otherwise the users config is used - JUPYTER_CONFIG_DIR={envdir}/etc/jupyter - JUPYTER_DATA_DIR={envdir}/share/jupyter -deps = - pytest<8.0.0 - pytest-html<4.0.0, - # selenium juypter notebook tests - notebook==7.0.2 - # fixing selenium version to have backwards-compatibility with pytest-selenium - # see https://github.com/robotframework/SeleniumLibrary/issues/1835#issuecomment-1581426365 - selenium==4.9.0 - pytest-selenium - jupytext==1.15.0 - imageio - # we fix matplotlib for consistent image tests - matplotlib==3.7.2 - numpy<2.0.0 - scikit-image - ipympl -commands = - # converts the python files to ipython notebooks - jupytext tests/notebooks/*.py --to ipynb - pytest {posargs:-v} --driver Firefox - [testenv:tests-lab-3] description = Tests with jupyter lab version < 4