From b5d5904b3bfe1942a9e9be432a21a69e998ccb5e Mon Sep 17 00:00:00 2001 From: liadomide Date: Fri, 22 Sep 2023 15:04:28 +0300 Subject: [PATCH 01/11] Attempt to fix notebooks run on pipeline job --- .github/workflows/notebooks.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/notebooks.yml b/.github/workflows/notebooks.yml index 35d864d2..2802e35b 100644 --- a/.github/workflows/notebooks.yml +++ b/.github/workflows/notebooks.yml @@ -1,7 +1,8 @@ name: Test Notebooks on: - pull_request: - types: [opened, synchronize, reopened] + push: + branches: + - '*' jobs: build: From 860766b3e640869d36dc0a2b06db51d23ddb89d8 Mon Sep 17 00:00:00 2001 From: liadomide Date: Fri, 22 Sep 2023 16:43:15 +0300 Subject: [PATCH 02/11] Update action versions --- .github/workflows/build.yml | 4 ++-- .github/workflows/notebooks.yml | 4 ++-- .github/workflows/release.yml | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bbd3a071..b794f03f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,10 +15,10 @@ jobs: matrix: python-version: [ "3.8", "3.9" ] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v3 with: python-version: ${{ matrix.python-version }} diff --git a/.github/workflows/notebooks.yml b/.github/workflows/notebooks.yml index 2802e35b..30926aaf 100644 --- a/.github/workflows/notebooks.yml +++ b/.github/workflows/notebooks.yml @@ -11,10 +11,10 @@ jobs: strategy: fail-fast: false steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Set up Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v3 with: python-version: 3.8 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f4d8a946..b4363c4e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Install dependencies run: | From 3c0c406523e3369fe7ed35fe7bb67abaea6a839b Mon Sep 17 00:00:00 2001 From: liadomide Date: Fri, 22 Sep 2023 17:14:24 +0300 Subject: [PATCH 03/11] ConnectivityWidget not working from command line --- tvbwidgets/ui/connectivity_ipy/connectivity_widget.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tvbwidgets/ui/connectivity_ipy/connectivity_widget.py b/tvbwidgets/ui/connectivity_ipy/connectivity_widget.py index a447fe03..c1719959 100644 --- a/tvbwidgets/ui/connectivity_ipy/connectivity_widget.py +++ b/tvbwidgets/ui/connectivity_ipy/connectivity_widget.py @@ -20,9 +20,9 @@ from tvbwidgets.ui.connectivity_ipy.global_context import CONTEXT, ObservableAttrs DROPDOWN_KEY = 'dropdown' - pyvista.set_jupyter_backend('trame') + class CustomOutput(ipywidgets.Output): CONFIG = ConnectivityConfig() @@ -118,10 +118,9 @@ def __init__(self, width, height, **kwargs): super(Connectivity3DViewer, self).__init__([self.output], *kwargs) self.__init_view_connectivity() - CONTEXT.observe(lambda *args: self.__init_view_connectivity(), ObservableAttrs.CONNECTIVITY) + CONTEXT.observe(lambda *args: self.__refresh_connectivity(), ObservableAttrs.CONNECTIVITY) def __init_view_connectivity(self): - self.output.plotter.clear() points, edges = self.__add_actors() points_toggle, edges_toggle = self.__init_controls() @@ -143,13 +142,16 @@ def on_change_edges(change): edges_toggle.observe(on_change_edges, 'value') - self.children = [ ipywidgets.HBox(children=( points_toggle, edges_toggle)), self.output] self.output.display_actor(points) self.output.display_actor(edges) + + def __refresh_connectivity(self): + self.output.plotter.clear() + self.__init_view_connectivity() self.output.update_plot() def __init_controls(self): From 5f0e66a9b3b7e50c5636f98b07f5fa3aee661a90 Mon Sep 17 00:00:00 2001 From: "RIO\\teodora.misan" Date: Wed, 31 Jul 2024 12:20:00 +0300 Subject: [PATCH 04/11] fix-notebookrun: update run command for notebooks --- .github/workflows/notebooks.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/notebooks.yml b/.github/workflows/notebooks.yml index 30926aaf..84bd1a96 100644 --- a/.github/workflows/notebooks.yml +++ b/.github/workflows/notebooks.yml @@ -25,4 +25,6 @@ jobs: python -m pip install nbformat nbconvert - name: Run notebooks - run: python ./dev/notebook_runner.py notebooks + run: | + cd dev + python notebook_runner.py ../notebooks From f2456b4b96027888ceeb061e402ff005dbbadfed Mon Sep 17 00:00:00 2001 From: "RIO\\teodora.misan" Date: Wed, 31 Jul 2024 13:30:07 +0300 Subject: [PATCH 05/11] fix-notebookrun: exclude TimeSeriesEDF notebook for testing purposes --- .github/workflows/notebooks.yml | 4 +--- dev/notebook_runner.py | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/notebooks.yml b/.github/workflows/notebooks.yml index 84bd1a96..30926aaf 100644 --- a/.github/workflows/notebooks.yml +++ b/.github/workflows/notebooks.yml @@ -25,6 +25,4 @@ jobs: python -m pip install nbformat nbconvert - name: Run notebooks - run: | - cd dev - python notebook_runner.py ../notebooks + run: python ./dev/notebook_runner.py notebooks diff --git a/dev/notebook_runner.py b/dev/notebook_runner.py index e535fdf9..9b5c8ff0 100644 --- a/dev/notebook_runner.py +++ b/dev/notebook_runner.py @@ -37,7 +37,7 @@ def execute_notebook(in_path, notebook): if not os.getenv('CLB_AUTH'): os.environ['CLB_AUTH'] = 'abc' - notebooks = [file for file in os.listdir(in_path) if file.endswith(".ipynb")] + notebooks = [file for file in os.listdir(in_path) if file.endswith(".ipynb") and not file.startswith('TimeSeriesEDF')] # start as many threads as logical cpus with ThreadPool(cpu_count()) as pool: From c0ccb0607c18e0872e94fb49eadc5f86940c7550 Mon Sep 17 00:00:00 2001 From: "RIO\\teodora.misan" Date: Wed, 31 Jul 2024 13:39:22 +0300 Subject: [PATCH 06/11] fix-notebookrun: exclude HeadWidget notebook for testing purposes --- dev/notebook_runner.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/notebook_runner.py b/dev/notebook_runner.py index 9b5c8ff0..e9371f3b 100644 --- a/dev/notebook_runner.py +++ b/dev/notebook_runner.py @@ -37,7 +37,7 @@ def execute_notebook(in_path, notebook): if not os.getenv('CLB_AUTH'): os.environ['CLB_AUTH'] = 'abc' - notebooks = [file for file in os.listdir(in_path) if file.endswith(".ipynb") and not file.startswith('TimeSeriesEDF')] + notebooks = [file for file in os.listdir(in_path) if file.endswith(".ipynb") and not file.startswith('HeadWidget')] # start as many threads as logical cpus with ThreadPool(cpu_count()) as pool: From ecffbbf383aebb4a55b3d2d4910b2b44187cbfb6 Mon Sep 17 00:00:00 2001 From: "RIO\\teodora.misan" Date: Wed, 31 Jul 2024 14:07:00 +0300 Subject: [PATCH 07/11] fix-notebookrun: update notebooks run command to resolve TimeSeriesEDF notebook error --- .github/workflows/notebooks.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/notebooks.yml b/.github/workflows/notebooks.yml index 30926aaf..972d09b9 100644 --- a/.github/workflows/notebooks.yml +++ b/.github/workflows/notebooks.yml @@ -25,4 +25,6 @@ jobs: python -m pip install nbformat nbconvert - name: Run notebooks - run: python ./dev/notebook_runner.py notebooks + run: | + cd notebooks + python ../dev/notebook_runner.py . From d6df191fd45575f45c0d7206187d072a15a3aa60 Mon Sep 17 00:00:00 2001 From: "RIO\\teodora.misan" Date: Wed, 31 Jul 2024 14:30:28 +0300 Subject: [PATCH 08/11] fix-notebookrun: update notebook TimeSeriesEDF content for testing --- .github/workflows/notebooks.yml | 4 +- notebooks/TimeSeriesEDF.ipynb | 84 ++++++--------------------------- 2 files changed, 15 insertions(+), 73 deletions(-) diff --git a/.github/workflows/notebooks.yml b/.github/workflows/notebooks.yml index 972d09b9..30926aaf 100644 --- a/.github/workflows/notebooks.yml +++ b/.github/workflows/notebooks.yml @@ -25,6 +25,4 @@ jobs: python -m pip install nbformat nbconvert - name: Run notebooks - run: | - cd notebooks - python ../dev/notebook_runner.py . + run: python ./dev/notebook_runner.py notebooks diff --git a/notebooks/TimeSeriesEDF.ipynb b/notebooks/TimeSeriesEDF.ipynb index 75786cba..83fd5d26 100644 --- a/notebooks/TimeSeriesEDF.ipynb +++ b/notebooks/TimeSeriesEDF.ipynb @@ -26,7 +26,7 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "id": "56d5c4b6-7804-46d6-931f-fcc5593977d1", "metadata": {}, "outputs": [], @@ -36,26 +36,13 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "id": "28420169-2274-4e0e-a73d-c1ab54e6da9c", "metadata": { "scrolled": true, "tags": [] }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "17-04-2024 05:02:37 - DEBUG - tvbwidgets - Package is not fully installed\n", - "17-04-2024 05:02:37 - DEBUG - tvbwidgets - Version read from the internal package.json file\n", - "17-04-2024 05:02:37 - INFO - tvbwidgets - Version: 2.0.0\n", - "Using matplotlib as 2D backend.\n", - " INFO Cannot import syncrypto library.\n", - "17-04-2024 05:02:49 - INFO - tvbwidgets.core.pse.parameters - ImportError: Dask dependency is not included, so this functionality won't be available\n" - ] - } - ], + "outputs": [], "source": [ "import numpy as np\n", "from tvbwidgets.api import plot_timeseries\n", @@ -72,45 +59,27 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "id": "94687d23-0222-4e9f-887e-e97169737304", "metadata": { "tags": [] }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Extracting EDF parameters from C:\\Work\\TVB\\tvb-widgets\\tvbwidgets\\tests\\data\\test_file.edf...\n", - "EDF file detected\n", - "Setting channel info structure...\n", - "Creating raw.info structure...\n" - ] - } - ], + "outputs": [], "source": [ - "edf_file_path = '../tvbwidgets/tests/data/test_file.edf' # replace path with your actual EDF file path\n", + "edf_file_path = 'tvbwidgets/tests/data/test_file.edf' # replace path with your actual EDF file path\n", + " # set this path file for notebooks tests\n", + "# you can use: '../tvbwidgets/tests/data/test_file.edf'\n", "data, freq, index = read_edf_file(edf_file_path)" ] }, { "cell_type": "code", - "execution_count": 4, + "execution_count": null, "id": "12da93b3-f96f-44cf-8555-52eee8aaecfd", "metadata": { "tags": [] }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "(92000, 32)\n", - "400.0\n" - ] - } - ], + "outputs": [], "source": [ "print(data.shape)\n", "print(freq)" @@ -126,7 +95,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": null, "id": "cac83fe3-b4fe-486a-8955-70203dda1004", "metadata": {}, "outputs": [], @@ -136,35 +105,10 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": null, "id": "20c3eae2-49dd-4d01-af9a-06a0dba15888", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "17-04-2024 05:02:49 - INFO - tvbwidgets.ui.ts.plotly_ts_widget - TimeSeries Widget with Plotly initialized\n", - "Creating RawArray with float64 data, n_channels=32, n_times=92000\n", - " Range : 0 ... 91999 = 0.000 ... 229.998 secs\n", - "Ready.\n" - ] - }, - { - "data": { - "application/vnd.jupyter.widget-view+json": { - "model_id": "28d8ffb85be94f28b59e85b521e4aeeb", - "version_major": 2, - "version_minor": 0 - }, - "text/plain": [ - "TimeSeriesWidgetPlotly(children=(HBox(children=(Output(),)), VBox(children=(Dropdown(description='Colormap:', …" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "outputs": [], "source": [ "tsw = plot_timeseries(data=data, sample_freq=freq, ch_idx=index, backend=backend)" ] @@ -194,7 +138,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.18" + "version": "3.9.19" } }, "nbformat": 4, From 4f5f706fae4f2f83756e778496956766dfb9e435 Mon Sep 17 00:00:00 2001 From: "RIO\\teodora.misan" Date: Tue, 6 Aug 2024 14:20:41 +0300 Subject: [PATCH 09/11] fix-notebookrun: update notebooks.yml to use ubuntu image --- .github/workflows/notebooks.yml | 9 +++++++-- dev/notebook_runner.py | 2 +- tvbwidgets/ui/head_widget.py | 3 +++ 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/workflows/notebooks.yml b/.github/workflows/notebooks.yml index 30926aaf..af1454a9 100644 --- a/.github/workflows/notebooks.yml +++ b/.github/workflows/notebooks.yml @@ -7,7 +7,7 @@ on: jobs: build: name: Run notebooks - runs-on: windows-latest + runs-on: ubuntu-latest strategy: fail-fast: false steps: @@ -18,6 +18,11 @@ jobs: with: python-version: 3.8 + - name: Install system dependencies + run: | + sudo apt-get update + sudo apt-get install -y libgl1 xvfb + - name: Install dependencies run: | python -m pip install --upgrade pip @@ -25,4 +30,4 @@ jobs: python -m pip install nbformat nbconvert - name: Run notebooks - run: python ./dev/notebook_runner.py notebooks + run: xvfb-run -a python ./dev/notebook_runner.py notebooks diff --git a/dev/notebook_runner.py b/dev/notebook_runner.py index e9371f3b..e535fdf9 100644 --- a/dev/notebook_runner.py +++ b/dev/notebook_runner.py @@ -37,7 +37,7 @@ def execute_notebook(in_path, notebook): if not os.getenv('CLB_AUTH'): os.environ['CLB_AUTH'] = 'abc' - notebooks = [file for file in os.listdir(in_path) if file.endswith(".ipynb") and not file.startswith('HeadWidget')] + notebooks = [file for file in os.listdir(in_path) if file.endswith(".ipynb")] # start as many threads as logical cpus with ThreadPool(cpu_count()) as pool: diff --git a/tvbwidgets/ui/head_widget.py b/tvbwidgets/ui/head_widget.py index e13860fa..59299da0 100644 --- a/tvbwidgets/ui/head_widget.py +++ b/tvbwidgets/ui/head_widget.py @@ -16,7 +16,9 @@ from tvbwidgets.ui.base_widget import TVBWidget from tvbwidgets.ui.widget_with_browser import TVBWidgetWithBrowser +from tvbwidgets.core.logger.builder import get_logger +LOGGER = get_logger(__name__) pyvista.set_jupyter_backend('trame') @@ -85,6 +87,7 @@ def hide_actor(self, actor): def update_plot(self): with self: + LOGGER.info('Update plot.') self.clear_output(wait=True) self.plotter.show() From 2fc82a54dd90e728c89148f8051f33fb57d678df Mon Sep 17 00:00:00 2001 From: "RIO\\teodora.misan" Date: Tue, 6 Aug 2024 14:42:46 +0300 Subject: [PATCH 10/11] fix-notebookrun: undo changes when to run the notebooks tests --- .github/workflows/notebooks.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/notebooks.yml b/.github/workflows/notebooks.yml index af1454a9..8d4179fd 100644 --- a/.github/workflows/notebooks.yml +++ b/.github/workflows/notebooks.yml @@ -1,8 +1,7 @@ name: Test Notebooks on: - push: - branches: - - '*' + pull_request: + types: [opened, synchronize, reopened] jobs: build: From 524b4ff1351d6900fbdc4b7ae03d720fa16e3887 Mon Sep 17 00:00:00 2001 From: "RIO\\teodora.misan" Date: Tue, 6 Aug 2024 16:51:44 +0300 Subject: [PATCH 11/11] fix-notebookrun: add the check of notebooks to run on pushes --- .github/workflows/notebooks.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/notebooks.yml b/.github/workflows/notebooks.yml index 8d4179fd..41812acf 100644 --- a/.github/workflows/notebooks.yml +++ b/.github/workflows/notebooks.yml @@ -1,5 +1,8 @@ name: Test Notebooks on: + push: + branches: + - '*' pull_request: types: [opened, synchronize, reopened]