This is an automated email from the ASF dual-hosted git repository.
potiuk pushed a commit to branch v3-1-test
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/v3-1-test by this push:
new f72116c250f [v3-1-test] Fix mypy checks in CI to also run for scripts
(#60898) (#60906)
f72116c250f is described below
commit f72116c250f45ef28a17ba12ae6d2e5f8d270a6a
Author: Jarek Potiuk <[email protected]>
AuthorDate: Thu Jan 22 17:05:13 2026 +0100
[v3-1-test] Fix mypy checks in CI to also run for scripts (#60898) (#60906)
Mypy Checks in CI have not been run on "scripts" folder - only on
dev folder and if a mypy error creeped-in, it remained undetected
unless someone run `pre-push` mypy check that instead of folders
run it on individual files.
This PR fixes the errors that creeped in and fixes the CI so that
mypy-dev also checks scripts.
(cherry picked from commit 7214ff86079d95f0ca05b3ac251bc73e5ef88846)
---
.pre-commit-config.yaml | 2 +-
scripts/ci/prek/mypy_folder.py | 1 +
scripts/ci/prek/upgrade_important_versions.py | 9 ++++++---
3 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 4c810df568d..c5fecbcbdd0 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -1055,7 +1055,7 @@ repos:
stages: ['manual']
name: Run mypy for dev (manual)
language: python
- entry: ./scripts/ci/prek/mypy_folder.py dev
+ entry: ./scripts/ci/prek/mypy_folder.py dev scripts
pass_filenames: false
files: ^.*\.py$
require_serial: true
diff --git a/scripts/ci/prek/mypy_folder.py b/scripts/ci/prek/mypy_folder.py
index f581901e365..16606b1db27 100755
--- a/scripts/ci/prek/mypy_folder.py
+++ b/scripts/ci/prek/mypy_folder.py
@@ -47,6 +47,7 @@ ALLOWED_FOLDERS = [
"airflow-core",
*[f"providers/{provider_id.replace('.', '/')}" for provider_id in
get_all_provider_ids()],
"dev",
+ "scripts",
"devel-common",
"task-sdk",
"airflow-ctl",
diff --git a/scripts/ci/prek/upgrade_important_versions.py
b/scripts/ci/prek/upgrade_important_versions.py
index 179ee985e0c..3670f3c0856 100755
--- a/scripts/ci/prek/upgrade_important_versions.py
+++ b/scripts/ci/prek/upgrade_important_versions.py
@@ -193,7 +193,7 @@ def get_latest_image_version(image: str) -> str:
# DockerHub API endpoint for tags
url =
f"https://registry.hub.docker.com/v2/repositories/{namespace}/{repository}/tags"
- params = {"page_size": 100, "ordering": "last_updated"}
+ params: dict[str, int | str] = {"page_size": 100, "ordering":
"last_updated"}
headers = {"User-Agent": "Python requests"}
response = requests.get(url, headers=headers, params=params)
@@ -463,7 +463,7 @@ def apply_pattern_replacements(
# Configuration for packages that follow simple version constant patterns
-SIMPLE_VERSION_PATTERNS = {
+SIMPLE_VERSION_PATTERNS: dict[str, list[tuple[str, str]]] = {
"hatch": [
(r"(HATCH_VERSION = )(\"[0-9.abrc]+\")", 'HATCH_VERSION =
"{version}"'),
(r"(HATCH_VERSION=)(\"[0-9.abrc]+\")", 'HATCH_VERSION="{version}"'),
@@ -590,13 +590,16 @@ def update_file_with_versions(
new_content, latest_python_version,
AIRFLOW_IMAGE_PYTHON_PATTERNS, keep_length
)
+ return _apply_simple_regexp_replacements(new_content, versions)
+
+
+def _apply_simple_regexp_replacements(new_content: str, versions: dict[str,
str]) -> str:
# Apply simple regex replacements
for package_name, patterns in SIMPLE_VERSION_PATTERNS.items():
should_upgrade = globals().get(f"UPGRADE_{package_name.upper()}",
False)
version = versions.get(package_name, "")
if should_upgrade and version:
new_content = apply_simple_regex_replacements(new_content,
version, patterns)
-
return new_content