From ee6c522b502a16cb1aac86bde089f16ca7a3ebd4 Mon Sep 17 00:00:00 2001 From: Talley Lambert Date: Sun, 9 Nov 2025 12:41:46 -0500 Subject: [PATCH 1/8] fix: fix pydantic warning --- src/app_model/types/_keys/_keybindings.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/app_model/types/_keys/_keybindings.py b/src/app_model/types/_keys/_keybindings.py index ee8f5dc..af2ed7b 100644 --- a/src/app_model/types/_keys/_keybindings.py +++ b/src/app_model/types/_keys/_keybindings.py @@ -159,10 +159,12 @@ def _parse_input(cls, v: Any) -> "SimpleKeyBinding": return cls.from_int(v) raise TypeError(f"invalid type: {type(v)}") - @model_validator(mode="after") # type: ignore + @model_validator(mode="before") @classmethod - def _model_val(cls, instance: "SimpleKeyBinding") -> "SimpleKeyBinding": - return cls._parse_input(instance) + def _model_val(cls, val: "SimpleKeyBinding") -> "SimpleKeyBinding": + if not isinstance(val, (SimpleKeyBinding, dict)): + return cls._parse_input(val) + return val MIN1 = {"min_length": 1} From f3e154556314016f71759f6167c11d77ef298c9f Mon Sep 17 00:00:00 2001 From: Talley Lambert Date: Sun, 9 Nov 2025 13:22:02 -0500 Subject: [PATCH 2/8] fix pyside parsing --- pyproject.toml | 2 +- src/app_model/backends/qt/_qkeymap.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index d446e00..96c9185 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -77,7 +77,7 @@ dev = [ "mypy>=1.13.0", "pdbpp>=0.11.6; sys_platform != 'win32'", "pre-commit-uv>=4", - "pyqt6>=6.8.0", + # "pyqt6>=6.8.0", "rich>=13.9.4", "pyright>=1.1.402", ] diff --git a/src/app_model/backends/qt/_qkeymap.py b/src/app_model/backends/qt/_qkeymap.py index bcaf0db..01ddcad 100644 --- a/src/app_model/backends/qt/_qkeymap.py +++ b/src/app_model/backends/qt/_qkeymap.py @@ -7,7 +7,6 @@ from functools import reduce from typing import TYPE_CHECKING -from qtpy import API, QT_VERSION # pyright: ignore[reportAttributeAccessIssue] from qtpy.QtCore import QCoreApplication, Qt from qtpy.QtGui import QKeySequence @@ -86,8 +85,9 @@ def simple_keybinding_to_qint(skb: SimpleKeyBinding) -> int: return int(out) -if QT6 and not (API == "pyside6" and int(QT_VERSION[2]) < 4): - +if QT6: + # note: this doesn't work on pyside6 < 6.5 ... + # but we don't support that anymore def _get_qmods(key: QKeyCombination) -> Qt.KeyboardModifier: return key.keyboardModifiers() From 6b2835079ee017da5ec02750ca1f0db7e3280e8c Mon Sep 17 00:00:00 2001 From: Talley Lambert Date: Sun, 9 Nov 2025 13:26:14 -0500 Subject: [PATCH 3/8] fix check --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5ff4aeb..6aca9a3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,7 +26,7 @@ jobs: steps: - uses: actions/checkout@v5 - uses: astral-sh/setup-uv@v7 - - run: uv run pyright + - run: uv run --with pyqt6 pyright test: name: ${{ matrix.platform }} py${{ matrix.python-version }} From cbab63d85524ae9e58f0d777c15e5e7537bf4e04 Mon Sep 17 00:00:00 2001 From: Talley Lambert Date: Sun, 9 Nov 2025 13:27:55 -0500 Subject: [PATCH 4/8] add back dev pyqt6 --- .github/workflows/ci.yml | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6aca9a3..5ff4aeb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,7 +26,7 @@ jobs: steps: - uses: actions/checkout@v5 - uses: astral-sh/setup-uv@v7 - - run: uv run --with pyqt6 pyright + - run: uv run pyright test: name: ${{ matrix.platform }} py${{ matrix.python-version }} diff --git a/pyproject.toml b/pyproject.toml index 96c9185..d446e00 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -77,7 +77,7 @@ dev = [ "mypy>=1.13.0", "pdbpp>=0.11.6; sys_platform != 'win32'", "pre-commit-uv>=4", - # "pyqt6>=6.8.0", + "pyqt6>=6.8.0", "rich>=13.9.4", "pyright>=1.1.402", ] From b6ccdc6261fa893c7d1b7be25e77e480a32f5bea Mon Sep 17 00:00:00 2001 From: Talley Lambert Date: Sun, 9 Nov 2025 13:28:30 -0500 Subject: [PATCH 5/8] no no... that was a good change --- .github/workflows/ci.yml | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5ff4aeb..6aca9a3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,7 +26,7 @@ jobs: steps: - uses: actions/checkout@v5 - uses: astral-sh/setup-uv@v7 - - run: uv run pyright + - run: uv run --with pyqt6 pyright test: name: ${{ matrix.platform }} py${{ matrix.python-version }} diff --git a/pyproject.toml b/pyproject.toml index d446e00..96c9185 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -77,7 +77,7 @@ dev = [ "mypy>=1.13.0", "pdbpp>=0.11.6; sys_platform != 'win32'", "pre-commit-uv>=4", - "pyqt6>=6.8.0", + # "pyqt6>=6.8.0", "rich>=13.9.4", "pyright>=1.1.402", ] From 4c8d9698fed8aea0b81b5ed34bcf7c7f891d86c3 Mon Sep 17 00:00:00 2001 From: Talley Lambert Date: Sun, 9 Nov 2025 13:36:29 -0500 Subject: [PATCH 6/8] pin both lower --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 96c9185..79a3b18 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -55,7 +55,7 @@ pyqt5 = [ "pyqt5-qt5==5.15.2; sys_platform == 'win32'", "pyqt5-qt5>=5.15.4; sys_platform != 'win32'", ] -pyqt6 = ["app-model[qt]", "PyQt6>=6.4.0"] +pyqt6 = ["app-model[qt]", "PyQt6>=6.4.0", "pyqt6-qt6>=6.4.0"] pyside2 = ["app-model[qt]", "PySide2>=5.15.2.1"] pyside6 = ["app-model[qt]", "PySide6>=6.6.0"] From b4a8c2ec95edff2511f2f68041269d27a77e1afe Mon Sep 17 00:00:00 2001 From: Talley Lambert Date: Sun, 9 Nov 2025 13:38:25 -0500 Subject: [PATCH 7/8] bump napari version --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6aca9a3..dd0010f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -152,7 +152,7 @@ jobs: dependency-extras: "testing" qt: ${{ matrix.qt }} pytest-args: 'src/napari/_qt/_qapp_model src/napari/_app_model src/napari/utils/_tests/test_key_bindings.py --import-mode=importlib -k "not async and not qt_dims_2"' - python-version: "3.10" + python-version: "3.11" strategy: fail-fast: false matrix: From f2bdc247198c1059522a4ed0cea0396d549f2604 Mon Sep 17 00:00:00 2001 From: Talley Lambert Date: Sun, 9 Nov 2025 13:41:56 -0500 Subject: [PATCH 8/8] try pyside6 --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dd0010f..310948c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -156,7 +156,7 @@ jobs: strategy: fail-fast: false matrix: - qt: ["pyqt5", "pyside2"] + qt: ["pyqt5", "pyside6"] build-and-inspect-package: name: Build & inspect package.