From d5aa917ee78eeed65908f173a6370753234ef6a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Fri, 4 Jul 2025 17:18:13 +0200 Subject: [PATCH] migrate all projects to python 3.13 linting --- lib/test/container-test-driver/pyproject.toml | 2 +- pkgs/clan-app/pyproject.toml | 2 +- pkgs/clan-app/tests/wayland.py | 4 ++-- pkgs/clan-vm-manager/clan_vm_manager/components/gkvstore.py | 4 ++-- pkgs/clan-vm-manager/clan_vm_manager/components/vmobj.py | 2 +- pkgs/clan-vm-manager/clan_vm_manager/views/details.py | 2 +- pkgs/clan-vm-manager/clan_vm_manager/views/list.py | 2 +- pkgs/clan-vm-manager/pyproject.toml | 2 +- pkgs/clan-vm-manager/tests/wayland.py | 4 ++-- pkgs/generate-test-vars/pyproject.toml | 2 +- 10 files changed, 13 insertions(+), 13 deletions(-) diff --git a/lib/test/container-test-driver/pyproject.toml b/lib/test/container-test-driver/pyproject.toml index c9c3abf54..4a4c3e062 100644 --- a/lib/test/container-test-driver/pyproject.toml +++ b/lib/test/container-test-driver/pyproject.toml @@ -15,7 +15,7 @@ find = {} [tool.setuptools.package-data] test_driver = ["py.typed"] [tool.mypy] -python_version = "3.12" +python_version = "3.13" warn_redundant_casts = true disallow_untyped_calls = true disallow_untyped_defs = true diff --git a/pkgs/clan-app/pyproject.toml b/pkgs/clan-app/pyproject.toml index 60083f92a..25147331f 100644 --- a/pkgs/clan-app/pyproject.toml +++ b/pkgs/clan-app/pyproject.toml @@ -30,7 +30,7 @@ norecursedirs = "tests/helpers" markers = ["impure"] [tool.mypy] -python_version = "3.12" +python_version = "3.13" warn_redundant_casts = true disallow_untyped_calls = true disallow_untyped_defs = true diff --git a/pkgs/clan-app/tests/wayland.py b/pkgs/clan-app/tests/wayland.py index 9fa73961c..2c4ee1ee9 100644 --- a/pkgs/clan-app/tests/wayland.py +++ b/pkgs/clan-app/tests/wayland.py @@ -7,7 +7,7 @@ import pytest @pytest.fixture(scope="session") -def wayland_compositor() -> Generator[Popen, None, None]: +def wayland_compositor() -> Generator[Popen]: # Start the Wayland compositor (e.g., Weston) # compositor = Popen(["weston", "--backend=headless-backend.so"]) compositor = Popen(["weston"]) @@ -20,7 +20,7 @@ GtkProc = NewType("GtkProc", Popen) @pytest.fixture -def app() -> Generator[GtkProc, None, None]: +def app() -> Generator[GtkProc]: cmd = [sys.executable, "-m", "clan_app"] print(f"Running: {cmd}") rapp = Popen( diff --git a/pkgs/clan-vm-manager/clan_vm_manager/components/gkvstore.py b/pkgs/clan-vm-manager/clan_vm_manager/components/gkvstore.py index 9d4d0abab..f830b1073 100644 --- a/pkgs/clan-vm-manager/clan_vm_manager/components/gkvstore.py +++ b/pkgs/clan-vm-manager/clan_vm_manager/components/gkvstore.py @@ -1,6 +1,6 @@ import logging from collections.abc import Callable -from typing import Any, Generic, TypeVar +from typing import Any, TypeVar import gi @@ -22,7 +22,7 @@ V = TypeVar( # clan_vm_manager/components/gkvstore.py:21: error: Definition of "newv" in base class "Object" is incompatible with definition in base class "GInterface" [misc] # clan_vm_manager/components/gkvstore.py:21: error: Definition of "install_properties" in base class "Object" is incompatible with definition in base class "GInterface" [misc] # clan_vm_manager/components/gkvstore.py:21: error: Definition of "getv" in base class "Object" is incompatible with definition in base class "GInterface" [misc] -class GKVStore(GObject.GObject, Gio.ListModel, Generic[K, V]): # type: ignore[misc] +class GKVStore[K, V: GObject.Object](GObject.GObject, Gio.ListModel): # type: ignore[misc] """ A simple key-value store that implements the Gio.ListModel interface, with generic types for keys and values. Only use self[key] and del self[key] for accessing the items for better performance. diff --git a/pkgs/clan-vm-manager/clan_vm_manager/components/vmobj.py b/pkgs/clan-vm-manager/clan_vm_manager/components/vmobj.py index 0be941739..1c4c60f75 100644 --- a/pkgs/clan-vm-manager/clan_vm_manager/components/vmobj.py +++ b/pkgs/clan-vm-manager/clan_vm_manager/components/vmobj.py @@ -143,7 +143,7 @@ class VMObject(GObject.Object): # We use a context manager to create the machine object # and make sure it is destroyed when the context is exited @contextmanager - def _create_machine(self) -> Generator[Machine, None, None]: + def _create_machine(self) -> Generator[Machine]: uri = ClanURI.from_str( url=str(self.data.flake.flake_url), machine_name=self.data.flake.flake_attr ) diff --git a/pkgs/clan-vm-manager/clan_vm_manager/views/details.py b/pkgs/clan-vm-manager/clan_vm_manager/views/details.py index c9ec2f93f..df2d8fa17 100644 --- a/pkgs/clan-vm-manager/clan_vm_manager/views/details.py +++ b/pkgs/clan-vm-manager/clan_vm_manager/views/details.py @@ -12,7 +12,7 @@ from gi.repository import Adw, Gio, GObject, Gtk ListItem = TypeVar("ListItem", bound=GObject.Object) -def create_details_list( +def create_details_list[ListItem: GObject.Object]( model: Gio.ListStore, render_row: Callable[[Gtk.ListBox, ListItem], Gtk.Widget] ) -> Gtk.ListBox: boxed_list = Gtk.ListBox() diff --git a/pkgs/clan-vm-manager/clan_vm_manager/views/list.py b/pkgs/clan-vm-manager/clan_vm_manager/views/list.py index b0ff077c5..5f104989b 100644 --- a/pkgs/clan-vm-manager/clan_vm_manager/views/list.py +++ b/pkgs/clan-vm-manager/clan_vm_manager/views/list.py @@ -32,7 +32,7 @@ ListItem = TypeVar("ListItem", bound=GObject.Object) CustomStore = TypeVar("CustomStore", bound=Gio.ListModel) -def create_boxed_list( +def create_boxed_list[CustomStore: Gio.ListModel, ListItem: GObject.Object]( model: CustomStore, render_row: Callable[[Gtk.ListBox, ListItem], Gtk.Widget], ) -> Gtk.ListBox: diff --git a/pkgs/clan-vm-manager/pyproject.toml b/pkgs/clan-vm-manager/pyproject.toml index 6e39b3fec..4de277719 100644 --- a/pkgs/clan-vm-manager/pyproject.toml +++ b/pkgs/clan-vm-manager/pyproject.toml @@ -30,7 +30,7 @@ norecursedirs = "tests/helpers" markers = ["impure"] [tool.mypy] -python_version = "3.12" +python_version = "3.13" warn_redundant_casts = true disallow_untyped_calls = true disallow_untyped_defs = true diff --git a/pkgs/clan-vm-manager/tests/wayland.py b/pkgs/clan-vm-manager/tests/wayland.py index d2515ba86..c9563cd6e 100644 --- a/pkgs/clan-vm-manager/tests/wayland.py +++ b/pkgs/clan-vm-manager/tests/wayland.py @@ -7,7 +7,7 @@ import pytest @pytest.fixture(scope="session") -def wayland_compositor() -> Generator[Popen, None, None]: +def wayland_compositor() -> Generator[Popen]: # Start the Wayland compositor (e.g., Weston) # compositor = Popen(["weston", "--backend=headless-backend.so"]) compositor = Popen(["weston"]) @@ -20,7 +20,7 @@ GtkProc = NewType("GtkProc", Popen) @pytest.fixture -def app() -> Generator[GtkProc, None, None]: +def app() -> Generator[GtkProc]: rapp = Popen([sys.executable, "-m", "clan_vm_manager"], text=True) yield GtkProc(rapp) # Cleanup: Terminate your application diff --git a/pkgs/generate-test-vars/pyproject.toml b/pkgs/generate-test-vars/pyproject.toml index aede95ecb..e3d0472e2 100644 --- a/pkgs/generate-test-vars/pyproject.toml +++ b/pkgs/generate-test-vars/pyproject.toml @@ -26,7 +26,7 @@ addopts = "--durations 5 --color=yes --new-first" # Add --pdb for debugging norecursedirs = "tests/helpers" [tool.mypy] -python_version = "3.12" +python_version = "3.13" warn_redundant_casts = true disallow_untyped_calls = true disallow_untyped_defs = true