From 903d9f5c54754f9d6531682d889b0f5b35803445 Mon Sep 17 00:00:00 2001 From: Talley Lambert Date: Wed, 26 Aug 2026 13:48:45 +0200 Subject: [PATCH 1/2] ci(pre-commit): autoupdate hooks - validate-pyproject v0.25 -> 0.26 - typos v1.48.0 -> v1.49.0 - ruff v0.16.1 -> v0.16.4 - mypy v2.3.0 -> v2.3.1 Applies the new RUF036 fix in `_concrete.py`, and noqa's it in `test_no_order`, where the reversed `Union[None, int]` is the point of the test. Co-Authored-By: Claude Opus 5 --- .pre-commit-config.yaml | 8 ++++---- src/magicgui/widgets/_concrete.py | 2 +- tests/test_magicgui.py | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8187e4a4f..e6ebf4316 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -5,7 +5,7 @@ ci: repos: - repo: https://github.com/abravalheri/validate-pyproject - rev: v0.25 + rev: '0.26' hooks: - id: validate-pyproject @@ -16,20 +16,20 @@ repos: files: "^\\.github/workflows/.*\\.ya?ml$" - repo: https://github.com/adhtruong/mirrors-typos - rev: v1.48.0 + rev: v1.49.0 hooks: - id: typos args: [--force-exclude] # omitting --write-changes - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.16.1 + rev: v0.16.4 hooks: - id: ruff-check args: ["--fix", "--unsafe-fixes"] - id: ruff-format - repo: https://github.com/pre-commit/mirrors-mypy - rev: v2.3.0 + rev: v2.3.1 hooks: - id: mypy files: "^src/" diff --git a/src/magicgui/widgets/_concrete.py b/src/magicgui/widgets/_concrete.py index 7eb60a092..07062dd34 100644 --- a/src/magicgui/widgets/_concrete.py +++ b/src/magicgui/widgets/_concrete.py @@ -404,7 +404,7 @@ def __init__( self, mode: FileDialogMode = FileDialogMode.EXISTING_FILE, filter: str | None = None, - value: Path | tuple[Path, ...] | None | _Undefined = Undefined, + value: Path | tuple[Path, ...] | _Undefined | None = Undefined, **kwargs: Unpack[ValuedContainerKwargs], ) -> None: # use empty string as a null value diff --git a/tests/test_magicgui.py b/tests/test_magicgui.py index fb30bd5fa..d96a1e0f9 100644 --- a/tests/test_magicgui.py +++ b/tests/test_magicgui.py @@ -935,7 +935,7 @@ def test_no_order(): register_type(Union[int, None], return_callback=mock) @magicgui - def func() -> Union[None, int]: + def func() -> Union[None, int]: # noqa: RUF036 # deliberately reversed return 1 func() From 4c23979e25ade1ddc6d73a866aa456486eb8989a Mon Sep 17 00:00:00 2001 From: Talley Lambert Date: Wed, 26 Aug 2026 13:52:51 +0200 Subject: [PATCH 2/2] test: explain the RUF036 noqa in test_no_order Co-Authored-By: Claude Opus 5 --- tests/test_magicgui.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/test_magicgui.py b/tests/test_magicgui.py index d96a1e0f9..dbbb3345e 100644 --- a/tests/test_magicgui.py +++ b/tests/test_magicgui.py @@ -934,8 +934,10 @@ def test_no_order(): register_type(Union[int, None], return_callback=mock) + # registration above used Union[int, None]; annotating with the reversed + # order is the whole point of this test, so RUF036 must not "fix" it @magicgui - def func() -> Union[None, int]: # noqa: RUF036 # deliberately reversed + def func() -> Union[None, int]: # noqa: RUF036 return 1 func()