This is an automated email from the ASF dual-hosted git repository.

potiuk pushed a commit to branch v3-0-test
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/v3-0-test by this push:
     new dd70201da47 [v3-0-test] Add Python <=> Airflow compat filtering for 
breeze (#52386) (#52390)
dd70201da47 is described below

commit dd70201da47a4fd0c2b8ae390ec23ee0c6b3eba3
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Sat Jun 28 15:46:29 2025 +0200

    [v3-0-test] Add Python <=> Airflow compat filtering for breeze (#52386) 
(#52390)
    
    (cherry picked from commit 3ef47449cf3151cca54e69442c7182e0f3a490f3)
    
    Co-authored-by: Amogh Desai <[email protected]>
---
 .../commands/release_management_commands.py        | 23 ++++++++++++++++++++++
 dev/breeze/src/airflow_breeze/global_constants.py  |  5 +++++
 2 files changed, 28 insertions(+)

diff --git 
a/dev/breeze/src/airflow_breeze/commands/release_management_commands.py 
b/dev/breeze/src/airflow_breeze/commands/release_management_commands.py
index cad99a3b271..6ad40366779 100644
--- a/dev/breeze/src/airflow_breeze/commands/release_management_commands.py
+++ b/dev/breeze/src/airflow_breeze/commands/release_management_commands.py
@@ -98,6 +98,7 @@ from airflow_breeze.global_constants import (
     DEFAULT_PYTHON_MAJOR_MINOR_VERSION,
     DESTINATION_LOCATIONS,
     MULTI_PLATFORM,
+    PYTHON_TO_MIN_AIRFLOW_MAPPING,
     UV_VERSION,
 )
 from airflow_breeze.params.shell_params import ShellParams
@@ -2756,6 +2757,21 @@ def generate_issue_content_core(
     )
 
 
+def is_airflow_version_supported_for_python(airflow_version: str, 
python_version: str) -> bool:
+    from packaging.version import Version
+
+    min_airflow_version = PYTHON_TO_MIN_AIRFLOW_MAPPING.get(python_version)
+    if not min_airflow_version:
+        return False
+    return Version(airflow_version) >= Version(min_airflow_version)
+
+
+def get_airflow_versions_supported_by_python(
+    all_airflow_versions: list[str], python_version: str
+) -> list[str]:
+    return [v for v in all_airflow_versions if 
is_airflow_version_supported_for_python(v, python_version)]
+
+
 def get_all_constraint_files(
     refresh_constraints: bool,
     python_version: str,
@@ -2764,6 +2780,13 @@ def get_all_constraint_files(
     if refresh_constraints:
         shutil.rmtree(CONSTRAINTS_CACHE_PATH, ignore_errors=True)
     all_airflow_versions, airflow_release_dates = 
get_active_airflow_versions(confirm=False)
+
+    get_console().print(
+        f"[info]Filtering to only use airflow versions supported by current 
python version: {python_version}[/]"
+    )
+
+    all_airflow_versions = 
get_airflow_versions_supported_by_python(all_airflow_versions, python_version)
+
     if not CONSTRAINTS_CACHE_PATH.exists():
         with ci_group(f"Downloading constraints for all Airflow versions for 
Python {python_version}"):
             CONSTRAINTS_CACHE_PATH.mkdir(parents=True, exist_ok=True)
diff --git a/dev/breeze/src/airflow_breeze/global_constants.py 
b/dev/breeze/src/airflow_breeze/global_constants.py
index e1536bdc873..b16293f1318 100644
--- a/dev/breeze/src/airflow_breeze/global_constants.py
+++ b/dev/breeze/src/airflow_breeze/global_constants.py
@@ -46,6 +46,11 @@ APACHE_AIRFLOW_GITHUB_REPOSITORY = "apache/airflow"
 # Checked before putting in build cache
 ALLOWED_PYTHON_MAJOR_MINOR_VERSIONS = ["3.9", "3.10", "3.11", "3.12"]
 DEFAULT_PYTHON_MAJOR_MINOR_VERSION = ALLOWED_PYTHON_MAJOR_MINOR_VERSIONS[0]
+
+# Maps each supported Python version to the minimum Airflow version that 
supports it.
+# Used to filter Airflow versions incompatible with a given Python runtime.
+PYTHON_TO_MIN_AIRFLOW_MAPPING = {"3.10": "2.4.0"}
+
 ALLOWED_ARCHITECTURES = [Architecture.X86_64, Architecture.ARM]
 # Database Backends used when starting Breeze. The "none" value means that the 
configuration is invalid.
 # No database will be started - access to a database will fail.

Reply via email to