Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@
DEFAULT_PYTHON_MAJOR_MINOR_VERSION,
DESTINATION_LOCATIONS,
MULTI_PLATFORM,
PYTHON_TO_MIN_AIRFLOW_MAPPING,
UV_VERSION,
)
from airflow_breeze.params.shell_params import ShellParams
Expand Down Expand Up @@ -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,
Expand All @@ -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)
Expand Down
5 changes: 5 additions & 0 deletions dev/breeze/src/airflow_breeze/global_constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@
# 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.
Expand Down