This is an automated email from the ASF dual-hosted git repository.
potiuk 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 3ef47449cf3 Add Python <=> Airflow compat filtering for breeze (#52386)
3ef47449cf3 is described below
commit 3ef47449cf3151cca54e69442c7182e0f3a490f3
Author: Amogh Desai <[email protected]>
AuthorDate: Sat Jun 28 11:57:47 2025 +0530
Add Python <=> Airflow compat filtering for breeze (#52386)
---
.../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 9474cce67b5..d3fb805f03d 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 b2a381c854d..224a6d3be56 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.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.