From 8999d1b3140183f05556dd7ed8f41e82b90689bf Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sun, 12 Oct 2025 11:00:46 +0000 Subject: [PATCH 1/6] CI(deps): Update ruff to v0.14.0 --- .github/workflows/python-code-quality.yml | 2 +- .pre-commit-config.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/python-code-quality.yml b/.github/workflows/python-code-quality.yml index 374135184a5..88eb773b690 100644 --- a/.github/workflows/python-code-quality.yml +++ b/.github/workflows/python-code-quality.yml @@ -36,7 +36,7 @@ jobs: # renovate: datasource=pypi depName=bandit BANDIT_VERSION: "1.8.6" # renovate: datasource=pypi depName=ruff - RUFF_VERSION: "0.13.2" + RUFF_VERSION: "0.14.0" runs-on: ${{ matrix.os }} permissions: diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a5a18856343..249d098c069 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -42,7 +42,7 @@ repos: ) - repo: https://github.com/astral-sh/ruff-pre-commit # Ruff version. - rev: v0.13.2 + rev: v0.14.0 hooks: # Run the linter. - id: ruff-check From 1f9ddf432d6d03d71180d4b615ed3cf91e96216b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edouard=20Choini=C3=A8re?= <27212526+echoix@users.noreply.github.com> Date: Sun, 5 Oct 2025 21:34:05 +0000 Subject: [PATCH 2/6] CQ: Fix new F401 patterns in grass.temporal.core psycopg2 imports --- python/grass/temporal/core.py | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/python/grass/temporal/core.py b/python/grass/temporal/core.py index 1d6c64ec974..e1641f0fe9c 100644 --- a/python/grass/temporal/core.py +++ b/python/grass/temporal/core.py @@ -32,8 +32,11 @@ from __future__ import annotations -# import traceback +import atexit import os +import sqlite3 +from datetime import datetime +from importlib.util import find_spec from pathlib import Path import grass.script as gs @@ -42,22 +45,24 @@ from .c_libraries_interface import CLibrariesInterface -# Import all supported database backends -# Ignore import errors since they are checked later -import sqlite3 +# Import all supported database backends (sqlite3 imported above) +# Ignore import errors since they are checked later +db_errors: tuple[type[sqlite3.Error], type[psycopg2.Error]] | tuple[type[sqlite3.Error]] # Postgresql is optional, existence is checked when needed -try: - import psycopg2 +if find_spec("psycopg2") is not None and find_spec("psycopg2.extras") is not None: + # Following explanations on how importing submodules work + # from ruff's v0.13.3 new F401 handling https://github.com/astral-sh/ruff/pull/20200 + # importing "psycopg2.extras" actually makes an "import psycopg2", + # making the members of the form `psycopg2.*` available, and then also imports the + # extras and makes available the members of the form `psycopg2.extras.*`. import psycopg2.extras db_errors = (sqlite3.Error, psycopg2.Error) -except ImportError: +else: db_errors = (sqlite3.Error,) -import atexit -from datetime import datetime ############################################################################### From bbaff0a0ea73d477a47697f63d5b45c48a4d2a2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edouard=20Choini=C3=A8re?= <27212526+echoix@users.noreply.github.com> Date: Mon, 6 Oct 2025 11:52:58 +0000 Subject: [PATCH 3/6] wxgui: Remove import wx.aui from gui_core/infobar.py --- gui/wxpython/gui_core/infobar.py | 1 - 1 file changed, 1 deletion(-) diff --git a/gui/wxpython/gui_core/infobar.py b/gui/wxpython/gui_core/infobar.py index e9bd8b848a5..cf6ea07c0f4 100644 --- a/gui/wxpython/gui_core/infobar.py +++ b/gui/wxpython/gui_core/infobar.py @@ -18,7 +18,6 @@ import sys import wx -import wx.aui try: import wx.lib.agw.infobar as IB From 068025e343ba2f65136656abc83deee142584e1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edouard=20Choini=C3=A8re?= <27212526+echoix@users.noreply.github.com> Date: Mon, 6 Oct 2025 11:54:08 +0000 Subject: [PATCH 4/6] wxgui: Remove unused imports wx.adv and wx.combo when another import occurs --- gui/wxpython/gui_core/widgets.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/gui/wxpython/gui_core/widgets.py b/gui/wxpython/gui_core/widgets.py index ffbbed02e02..13f3d6f5846 100644 --- a/gui/wxpython/gui_core/widgets.py +++ b/gui/wxpython/gui_core/widgets.py @@ -65,10 +65,8 @@ from wx.lib.wordwrap import wordwrap if wxPythonPhoenix: - import wx.adv from wx.adv import OwnerDrawnComboBox else: - import wx.combo from wx.combo import OwnerDrawnComboBox try: import wx.lib.agw.flatnotebook as FN From 343583eb3d1037f5942cbe01feffc4fe17259c5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edouard=20Choini=C3=A8re?= <27212526+echoix@users.noreply.github.com> Date: Mon, 6 Oct 2025 11:54:30 +0000 Subject: [PATCH 5/6] wxgui: Remove import wx.aui from lmgr/workspace.py --- gui/wxpython/lmgr/workspace.py | 1 - 1 file changed, 1 deletion(-) diff --git a/gui/wxpython/lmgr/workspace.py b/gui/wxpython/lmgr/workspace.py index 395fd0b61a5..41eea57657b 100644 --- a/gui/wxpython/lmgr/workspace.py +++ b/gui/wxpython/lmgr/workspace.py @@ -21,7 +21,6 @@ from pathlib import Path import wx -import wx.aui from core.settings import UserSettings from core.gcmd import RunCommand, GError, GMessage From cac51aa7dcc0e5e31af6161fa97a2eef2347ab16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edouard=20Choini=C3=A8re?= <27212526+echoix@users.noreply.github.com> Date: Mon, 6 Oct 2025 11:54:59 +0000 Subject: [PATCH 6/6] wxgui: Remove unused import wx.html from wxgui.py --- gui/wxpython/wxgui.py | 1 - 1 file changed, 1 deletion(-) diff --git a/gui/wxpython/wxgui.py b/gui/wxpython/wxgui.py index 87f285213b6..05212146fd2 100644 --- a/gui/wxpython/wxgui.py +++ b/gui/wxpython/wxgui.py @@ -36,7 +36,6 @@ # we get annoying "Debug: Adding duplicate image handler for 'Windows bitmap file'" # during start up, remove when not needed import wx.adv -import wx.html try: import wx.lib.agw.advancedsplash as SC