From d26f22c99d7a5ab531c38ca49a87d0c04f89e413 Mon Sep 17 00:00:00 2001 From: Talley Lambert Date: Tue, 18 Jun 2024 10:39:13 -0400 Subject: [PATCH 01/15] wrap qt app install command, add 4 more libs --- action.yml | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/action.yml b/action.yml index e307a93..a2f87b4 100644 --- a/action.yml +++ b/action.yml @@ -26,9 +26,28 @@ runs: - name: Install Linux Qt dependencies if: runner.os == 'Linux' && inputs.qt != 'false' shell: bash - run: sudo apt install libxkbcommon-x11-0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-xinerama0 libxcb-xfixes0 libopengl0 libegl1 libosmesa6 mesa-utils libxcb-shape0 libxcb-cursor0 + run: | + sudo apt install -y \ + libdbus-1-3 \ + libegl1 \ + libegl1-mesa \ + libopengl0 \ + libosmesa6 \ + libxcb-cursor0 \ + libxcb-icccm4 \ + libxcb-image0 \ + libxcb-xinput0 \ + libxcb-keysyms1 \ + libxcb-randr0 \ + libxcb-render-util0 \ + libxcb-shape0 \ + libxcb-xfixes0 \ + libxcb-xinerama0 \ + libxkbcommon-x11-0 \ + mesa-utils \ + x11-utils - - name: Install Windows GL Dependencies + - name: Install Windows GL Dependencies if: runner.os == 'Windows' shell: cmd run: | From 8423c081e863276b09adfae8e8cb218cee40b731 Mon Sep 17 00:00:00 2001 From: Talley Lambert Date: Tue, 18 Jun 2024 10:41:23 -0400 Subject: [PATCH 02/15] use apt-get --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index a2f87b4..b22bdd3 100644 --- a/action.yml +++ b/action.yml @@ -27,7 +27,7 @@ runs: if: runner.os == 'Linux' && inputs.qt != 'false' shell: bash run: | - sudo apt install -y \ + sudo apt-get install -y \ libdbus-1-3 \ libegl1 \ libegl1-mesa \ From 89286cf7240ca93d2387b69e41ddc5e8a0dce67f Mon Sep 17 00:00:00 2001 From: Talley Lambert Date: Tue, 18 Jun 2024 10:42:52 -0400 Subject: [PATCH 03/15] sort lines --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index b22bdd3..a47937a 100644 --- a/action.yml +++ b/action.yml @@ -36,13 +36,13 @@ runs: libxcb-cursor0 \ libxcb-icccm4 \ libxcb-image0 \ - libxcb-xinput0 \ libxcb-keysyms1 \ libxcb-randr0 \ libxcb-render-util0 \ libxcb-shape0 \ libxcb-xfixes0 \ libxcb-xinerama0 \ + libxcb-xinput0 \ libxkbcommon-x11-0 \ mesa-utils \ x11-utils From 8f7cef527cbd69f38ed9b1389948bf37e3a471fd Mon Sep 17 00:00:00 2001 From: Talley Lambert Date: Tue, 18 Jun 2024 10:54:15 -0400 Subject: [PATCH 04/15] bump From 47eac4f89524f94a8a9e1b2c5bfcff398316e4bf Mon Sep 17 00:00:00 2001 From: Talley Lambert Date: Tue, 18 Jun 2024 10:59:42 -0400 Subject: [PATCH 05/15] fix indent --- action.yml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/action.yml b/action.yml index a47937a..05148bd 100644 --- a/action.yml +++ b/action.yml @@ -1,5 +1,5 @@ -name: 'setup-headless-display-action' -description: 'Setup a headless display on Linux and Windows' +name: "setup-headless-display-action" +description: "Setup a headless display on Linux and Windows" author: PyVista Developers' inputs: pyvista: @@ -11,12 +11,11 @@ inputs: required: false default: false branding: - icon: 'monitor' - color: 'blue' + icon: "monitor" + color: "blue" runs: using: "composite" steps: - - name: Install Linux dependencies if: runner.os == 'Linux' shell: bash @@ -47,7 +46,7 @@ runs: mesa-utils \ x11-utils - - name: Install Windows GL Dependencies + - name: Install Windows GL Dependencies if: runner.os == 'Windows' shell: cmd run: | From d5e79a9d9fe9054f6bbb4f57fb1fa1e2bb88fb74 Mon Sep 17 00:00:00 2001 From: Talley Lambert Date: Tue, 18 Jun 2024 11:03:15 -0400 Subject: [PATCH 06/15] update action versions --- .github/workflows/local.yml | 10 +++++----- .github/workflows/production.yml | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/local.yml b/.github/workflows/local.yml index a3f5d79..2a40bf1 100644 --- a/.github/workflows/local.yml +++ b/.github/workflows/local.yml @@ -28,7 +28,7 @@ jobs: runs-on: ${{ matrix.os }} steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Test Action uses: ./ @@ -36,9 +36,9 @@ jobs: qt: ${{ matrix.qt != '' }} - name: Setup Python - uses: actions/setup-python@v1 + uses: actions/setup-python@v5 with: - python-version: "3.9" + python-version: "3.10" - name: Install PyVista run: pip install pyvista @@ -46,7 +46,7 @@ jobs: - name: Test PyVista run: python tests/test_pyvista.py - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v4 with: name: ${{ matrix.os }}-sphere path: sphere.png @@ -62,7 +62,7 @@ jobs: QT_DEBUG_PLUGINS=1 LIBGL_DEBUG=verbose python tests/test_qt.py shell: bash - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v4 with: name: cube path: ${{ matrix.os }}-cube.png diff --git a/.github/workflows/production.yml b/.github/workflows/production.yml index 924c88f..375a01c 100644 --- a/.github/workflows/production.yml +++ b/.github/workflows/production.yml @@ -16,9 +16,9 @@ jobs: uses: pyvista/setup-headless-display-action@v1 - name: Setup Python - uses: actions/setup-python@v1 + uses: actions/setup-python@v5 with: - python-version: 3.9 + python-version: "3.10" - name: Install PyVista run: pip install pyvista @@ -26,7 +26,7 @@ jobs: - name: Use PyVista run: python -c "import pyvista;pyvista.Sphere().plot(screenshot='${{ matrix.os }}-sphere.png')" - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v4 with: name: sphere path: ${{ matrix.os }}-sphere.png From 10bf02bcf97e79958db0275cedf05ecc56631eda Mon Sep 17 00:00:00 2001 From: Talley Lambert Date: Tue, 18 Jun 2024 11:15:49 -0400 Subject: [PATCH 07/15] add dbus test --- .github/workflows/local.yml | 4 ++-- .github/workflows/production.yml | 2 +- tests/test_qt.py | 3 +++ 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/local.yml b/.github/workflows/local.yml index 2a40bf1..e7ed0e6 100644 --- a/.github/workflows/local.yml +++ b/.github/workflows/local.yml @@ -46,7 +46,7 @@ jobs: - name: Test PyVista run: python tests/test_pyvista.py - - uses: actions/upload-artifact@v4 + - uses: actions/upload-artifact@v2 with: name: ${{ matrix.os }}-sphere path: sphere.png @@ -62,7 +62,7 @@ jobs: QT_DEBUG_PLUGINS=1 LIBGL_DEBUG=verbose python tests/test_qt.py shell: bash - - uses: actions/upload-artifact@v4 + - uses: actions/upload-artifact@v2 with: name: cube path: ${{ matrix.os }}-cube.png diff --git a/.github/workflows/production.yml b/.github/workflows/production.yml index 375a01c..c32013c 100644 --- a/.github/workflows/production.yml +++ b/.github/workflows/production.yml @@ -26,7 +26,7 @@ jobs: - name: Use PyVista run: python -c "import pyvista;pyvista.Sphere().plot(screenshot='${{ matrix.os }}-sphere.png')" - - uses: actions/upload-artifact@v4 + - uses: actions/upload-artifact@v2 with: name: sphere path: ${{ matrix.os }}-sphere.png diff --git a/tests/test_qt.py b/tests/test_qt.py index 1d1b6c7..a926d19 100644 --- a/tests/test_qt.py +++ b/tests/test_qt.py @@ -4,3 +4,6 @@ plt.figure() backend = matplotlib.get_backend() assert backend == 'QtAgg', backend + +from qtpy import QtDBus +_ = QtDBus.QDBusConnection('Name') From 319c8dd30ac8cbef179b7cf01514abc98e285652 Mon Sep 17 00:00:00 2001 From: Talley Lambert Date: Tue, 18 Jun 2024 11:41:04 -0400 Subject: [PATCH 08/15] add vispy test --- .github/workflows/local.yml | 11 +++++++++++ tests/test_vispy_qt.py | 18 ++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 tests/test_vispy_qt.py diff --git a/.github/workflows/local.yml b/.github/workflows/local.yml index e7ed0e6..a714ccd 100644 --- a/.github/workflows/local.yml +++ b/.github/workflows/local.yml @@ -66,3 +66,14 @@ jobs: with: name: cube path: ${{ matrix.os }}-cube.png + + - name: Test Vispy Qt + if: matrix.qt != '' + run: | + pip install vispy qtpy pillow + QT_DEBUG_PLUGINS=1 python tests/test_vispy_qt.py + + - uses: actions/upload-artifact@v2 + with: + name: vispy-volume + path: "*_vispy_volume.png" \ No newline at end of file diff --git a/tests/test_vispy_qt.py b/tests/test_vispy_qt.py new file mode 100644 index 0000000..efcf23e --- /dev/null +++ b/tests/test_vispy_qt.py @@ -0,0 +1,18 @@ +"""Quickly check if vispy off screen plotting works.""" + +from pathlib import Path +import sys +import numpy as np +from qtpy.QtWidgets import QApplication +from vispy import scene +from PIL import Image + +qapp = QApplication([]) +canvas = scene.SceneCanvas(size=(512, 512)) +view = canvas.central_widget.add_view() +vol_data = np.random.rand(64, 64, 64).astype(np.float32) +image = scene.visuals.Volume(vol_data, cmap="viridis", parent=view.scene) +view.camera = scene.ArcballCamera() +canvas.show() +out_path = Path(__file__).parent.parent / f"{sys.platform}_vispy_volume.png" +Image.fromarray(canvas.render()).save(out_path) From 3d1211ff3049184388776f414baa8602588ffdf5 Mon Sep 17 00:00:00 2001 From: Talley Lambert Date: Tue, 18 Jun 2024 11:50:13 -0400 Subject: [PATCH 09/15] add another conditional --- .github/workflows/local.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/local.yml b/.github/workflows/local.yml index c28e40d..c09fd36 100644 --- a/.github/workflows/local.yml +++ b/.github/workflows/local.yml @@ -65,6 +65,7 @@ jobs: MATRIX_OS: ${{ matrix.os }} MATRIX_QT: ${{ matrix.qt }} - uses: actions/upload-artifact@v4 + if: matrix.qt != '' with: name: ${{ matrix.os }}-${{ matrix.qt }}-vispy-volume path: ${{ matrix.os }}-${{ matrix.qt }}-vispy-volume.png From 954df6df1b08ddfbe385cd3b05c71fc7685e4a5a Mon Sep 17 00:00:00 2001 From: Talley Lambert Date: Tue, 18 Jun 2024 11:51:21 -0400 Subject: [PATCH 10/15] move qtpy --- .github/workflows/local.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/local.yml b/.github/workflows/local.yml index c09fd36..2c5118a 100644 --- a/.github/workflows/local.yml +++ b/.github/workflows/local.yml @@ -48,7 +48,7 @@ jobs: if: matrix.qt != '' run: | set -eo pipefail - pip install ${{ matrix.qt }} matplotlib + pip install ${{ matrix.qt }} matplotlib qtpy QT_DEBUG_PLUGINS=1 LIBGL_DEBUG=verbose python tests/test_qt.py shell: bash - uses: actions/upload-artifact@v4 @@ -59,7 +59,7 @@ jobs: - name: Test Vispy Qt if: matrix.qt != '' run: | - pip install vispy qtpy pillow + pip install vispy pillow QT_DEBUG_PLUGINS=1 python tests/test_vispy_qt.py env: MATRIX_OS: ${{ matrix.os }} From 12c7b70c297acd70d260abda29b6115e1f5ca189 Mon Sep 17 00:00:00 2001 From: Talley Lambert Date: Tue, 18 Jun 2024 11:52:59 -0400 Subject: [PATCH 11/15] add pyopengl --- .github/workflows/local.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/local.yml b/.github/workflows/local.yml index 2c5118a..ec2df9f 100644 --- a/.github/workflows/local.yml +++ b/.github/workflows/local.yml @@ -59,7 +59,7 @@ jobs: - name: Test Vispy Qt if: matrix.qt != '' run: | - pip install vispy pillow + pip install vispy pillow pyopengl QT_DEBUG_PLUGINS=1 python tests/test_vispy_qt.py env: MATRIX_OS: ${{ matrix.os }} From 8a1cd721864a254e76402e048be2c10fbb3641a6 Mon Sep 17 00:00:00 2001 From: Talley Lambert Date: Sat, 22 Jun 2024 17:23:40 -0400 Subject: [PATCH 12/15] remove debug plugins --- .github/workflows/local.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/local.yml b/.github/workflows/local.yml index ec2df9f..ffd5596 100644 --- a/.github/workflows/local.yml +++ b/.github/workflows/local.yml @@ -60,7 +60,7 @@ jobs: if: matrix.qt != '' run: | pip install vispy pillow pyopengl - QT_DEBUG_PLUGINS=1 python tests/test_vispy_qt.py + python tests/test_vispy_qt.py env: MATRIX_OS: ${{ matrix.os }} MATRIX_QT: ${{ matrix.qt }} From 819d36e609bcdaab43e438b4480e2aa0e1979086 Mon Sep 17 00:00:00 2001 From: Talley Lambert Date: Sat, 22 Jun 2024 17:25:12 -0400 Subject: [PATCH 13/15] add windows-latest qt --- .github/workflows/local.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/local.yml b/.github/workflows/local.yml index ffd5596..97cd424 100644 --- a/.github/workflows/local.yml +++ b/.github/workflows/local.yml @@ -23,6 +23,8 @@ jobs: qt: "pyqt5" - os: ubuntu-latest qt: "pyqt6" + - os: windows-latest + qt: "pyqt6" - os: ubuntu-latest qt: "pyside6" runs-on: ${{ matrix.os }} From c67d6c462784c5973d00ae52876980c7e4cc0f38 Mon Sep 17 00:00:00 2001 From: Talley Lambert Date: Sat, 22 Jun 2024 17:25:53 -0400 Subject: [PATCH 14/15] fix lint --- .github/workflows/local.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/local.yml b/.github/workflows/local.yml index 97cd424..c340d85 100644 --- a/.github/workflows/local.yml +++ b/.github/workflows/local.yml @@ -1,6 +1,6 @@ name: Local Testing -on: # yamllint disable-line rule:truthy +on: # yamllint disable-line rule:truthy pull_request: workflow_dispatch: schedule: From bba585defd203b70decced992b768262af57815a Mon Sep 17 00:00:00 2001 From: Talley Lambert Date: Sat, 22 Jun 2024 17:29:24 -0400 Subject: [PATCH 15/15] set seed --- tests/test_vispy_qt.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/test_vispy_qt.py b/tests/test_vispy_qt.py index 4bf68e7..7b682de 100644 --- a/tests/test_vispy_qt.py +++ b/tests/test_vispy_qt.py @@ -10,6 +10,7 @@ qapp = QApplication([]) canvas = scene.SceneCanvas(size=(512, 512)) view = canvas.central_widget.add_view() +np.random.seed(0) vol_data = np.random.rand(64, 64, 64).astype(np.float32) image = scene.visuals.Volume(vol_data, cmap="viridis", parent=view.scene) view.camera = scene.ArcballCamera()