This is an automated email from the ASF dual-hosted git repository.
eladkal pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new 29ff64795b9 update footer summary table for constraints version check
script (#64117)
29ff64795b9 is described below
commit 29ff64795b99b64c35d834256655d53e84f6c74e
Author: Elad Kalif <[email protected]>
AuthorDate: Mon Mar 23 22:47:21 2026 +0200
update footer summary table for constraints version check script (#64117)
---
.../utils/constraints_version_check.py | 42 +++++++++++++++-------
1 file changed, 30 insertions(+), 12 deletions(-)
diff --git a/dev/breeze/src/airflow_breeze/utils/constraints_version_check.py
b/dev/breeze/src/airflow_breeze/utils/constraints_version_check.py
index 900186e2f4a..d445481f18c 100755
--- a/dev/breeze/src/airflow_breeze/utils/constraints_version_check.py
+++ b/dev/breeze/src/airflow_breeze/utils/constraints_version_check.py
@@ -103,10 +103,13 @@ def get_status_emoji(constraint_date, latest_date,
is_latest_version):
All emojis used here (✅, 📢, 🔶, 🚨) are single Python chars with ~2 visual
cells,
so ljust produces consistent alignment without any offset workarounds.
+
+ Returns a tuple of (formatted_status_string, status_category) where
status_category
+ is one of "ok", "new", "warning", "critical".
"""
col_target = 16
if is_latest_version:
- return "✅ OK".ljust(col_target)
+ return "✅ OK".ljust(col_target), "ok"
try:
constraint_dt = datetime.strptime(constraint_date, "%Y-%m-%d")
@@ -114,12 +117,12 @@ def get_status_emoji(constraint_date, latest_date,
is_latest_version):
days_diff = (latest_dt - constraint_dt).days
if days_diff <= 5:
- return "📢 <5d".ljust(col_target)
+ return "📢 <5d".ljust(col_target), "new"
if days_diff <= 30:
- return "🔶 <30d".ljust(col_target)
- return f"🚨 >{days_diff}d".ljust(col_target)
+ return "🔶 <30d".ljust(col_target), "warning"
+ return f"🚨 >{days_diff}d".ljust(col_target), "critical"
except Exception:
- return "📢 N/A".ljust(col_target)
+ return "📢 N/A".ljust(col_target), "new"
def get_max_package_length(packages: list[tuple[str, str]]) -> int:
@@ -223,7 +226,7 @@ def constraints_version_check(
col_widths, format_str, headers, total_width = get_table_format(packages)
print_table_header(format_str, headers, total_width)
- outdated_count, skipped_count, explanations = process_packages(
+ outdated_count, skipped_count, explanations, status_counts =
process_packages(
packages=packages,
constraints_date=constraints_date,
mode=diff_mode,
@@ -241,6 +244,7 @@ def constraints_version_check(
outdated_count=outdated_count,
skipped_count=skipped_count,
mode=diff_mode,
+ status_counts=status_counts,
)
if explain_why and explanations:
print_explanations(explanations)
@@ -307,9 +311,20 @@ def print_table_header(format_str: str, headers:
list[str], total_width: int):
console_print(f"[magenta]{'=' * total_width}[/]")
-def print_table_footer(total_width: int, total_pkgs: int, outdated_count: int,
skipped_count: int, mode: str):
+def print_table_footer(
+ total_width: int,
+ total_pkgs: int,
+ outdated_count: int,
+ skipped_count: int,
+ mode: str,
+ status_counts: dict[str, int],
+):
console_print(f"[magenta]{'=' * total_width}[/]")
console_print(f"[bold cyan]\nTotal packages checked:[/]
[white]{total_pkgs}[/]")
+ console_print(f" [green]✅ Up to date:[/] [white]{status_counts['ok']}[/]")
+ console_print(f" [yellow]📢 New (<5d):[/]
[white]{status_counts['new']}[/]")
+ console_print(f" [yellow]🔶 Warning (<30d):[/]
[white]{status_counts['warning']}[/]")
+ console_print(f" [red]🚨 Critical (>30d):[/]
[white]{status_counts['critical']}[/]")
console_print(f"[bold yellow]Outdated packages found:[/]
[white]{outdated_count}[/]")
if mode == "diff-constraints":
console_print(
@@ -356,7 +371,7 @@ def process_packages(
python_version: str,
airflow_constraints_mode: str,
github_repository: str | None,
-) -> tuple[int, int, list[str]]:
+) -> tuple[int, int, list[str], dict[str, int]]:
@contextmanager
def preserve_pyproject_file(pyproject_path: Path):
original_content = pyproject_path.read_text()
@@ -382,6 +397,7 @@ def process_packages(
outdated_count = 0
skipped_count = 0
explanations = []
+ status_counts: dict[str, int] = {"ok": 0, "new": 0, "warning": 0,
"critical": 0}
for pkg, pinned_version in packages:
try:
@@ -394,7 +410,7 @@ def process_packages(
versions_behind = count_versions_between(releases, pinned_version,
latest_version)
versions_behind_str = str(versions_behind) if versions_behind > 0
else ""
if should_show_package(releases, latest_version, constraints_date,
mode, is_latest_version):
- print_package_table_row(
+ status_category = print_package_table_row(
pkg=pkg,
pinned_version=pinned_version,
constraint_release_date=constraint_release_date,
@@ -406,6 +422,7 @@ def process_packages(
is_latest_version=is_latest_version,
versions_behind_str=versions_behind_str,
)
+ status_counts[status_category] += 1
if not is_latest_version:
outdated_count += 1
else:
@@ -427,7 +444,7 @@ def process_packages(
except URLError as e:
console_print(f"[bold red]Error fetching {pkg} from PyPI:
{e.reason}[/]")
continue
- return outdated_count, skipped_count, explanations
+ return outdated_count, skipped_count, explanations, status_counts
def print_package_table_row(
@@ -441,9 +458,9 @@ def print_package_table_row(
format_str: str,
is_latest_version: bool,
versions_behind_str: str,
-):
+) -> str:
first_newer_date_str = get_first_newer_release_date_str(releases,
pinned_version)
- status = get_status_emoji(
+ status, status_category = get_status_emoji(
first_newer_date_str or constraint_release_date,
datetime.now().strftime("%Y-%m-%d"),
is_latest_version,
@@ -465,6 +482,7 @@ def print_package_table_row(
pypi_link,
)
console_print(f"[{color}]{string_to_print}[/]")
+ return status_category
def explain_package_upgrade(