diff --git a/airflow/__init__.py b/airflow/__init__.py index 4af74a44d2af1..3df4a11cb1215 100644 --- a/airflow/__init__.py +++ b/airflow/__init__.py @@ -75,6 +75,7 @@ PY39 = sys.version_info >= (3, 9) PY310 = sys.version_info >= (3, 10) PY311 = sys.version_info >= (3, 11) +PY312 = sys.version_info >= (3, 12) # Things to lazy import in form {local_name: ('target_module', 'target_name', 'deprecated')} __lazy_imports: dict[str, tuple[str, str, bool]] = { diff --git a/dev/README_RELEASE_AIRFLOW.md b/dev/README_RELEASE_AIRFLOW.md index 6b51c9189f7cc..faa4d1fd4c84d 100644 --- a/dev/README_RELEASE_AIRFLOW.md +++ b/dev/README_RELEASE_AIRFLOW.md @@ -872,7 +872,7 @@ the older branches, you should set the "skip" field to true. ## Verify production images ```shell script -for PYTHON in 3.8 3.9 3.10 3.11 +for PYTHON in 3.8 3.9 3.10 3.11 3.12 do docker pull apache/airflow:${VERSION}-python${PYTHON} breeze prod-image verify --image-name apache/airflow:${VERSION}-python${PYTHON} diff --git a/dev/breeze/README.md b/dev/breeze/README.md index e64de13a5632d..d0626c7a399d2 100644 --- a/dev/breeze/README.md +++ b/dev/breeze/README.md @@ -66,6 +66,6 @@ PLEASE DO NOT MODIFY THE HASH BELOW! IT IS AUTOMATICALLY UPDATED BY PRE-COMMIT. --------------------------------------------------------------------------------------------------------- -Package config hash: 5253de328868bc7e725254e1efe2daa57e7b1faee1b0be68aa8609569e47d08a1e0be4760bf889f422c4ce5c2884577c1300cd2f2292f2cb4677b1d1d160916c +Package config hash: c139c08b4272b97467c4a3d079237d69c1e4c489955a4a2e819ed7243fd6dcdd07f541f7c8d6c80594047446d3ede455191f6d9fc47904d77ddf17dab0aa70f8 --------------------------------------------------------------------------------------------------------- diff --git a/dev/breeze/pyproject.toml b/dev/breeze/pyproject.toml index 438719faa7e2d..2c8f96ad1d477 100644 --- a/dev/breeze/pyproject.toml +++ b/dev/breeze/pyproject.toml @@ -78,7 +78,7 @@ name = "airflow_breeze" [tool.black] line-length = 110 -target-version = ['py37', 'py38', 'py39', 'py310'] +target-version = ['py37', 'py38', 'py39', 'py310', 'py311', 'py312'] [tool.pytest.ini_options] addopts = "-rasl --verbosity=2 -p no:flaky -p no:nose -p no:legacypath" diff --git a/dev/breeze/src/airflow_breeze/global_constants.py b/dev/breeze/src/airflow_breeze/global_constants.py index ef1217acd78f1..9858b1de54d57 100644 --- a/dev/breeze/src/airflow_breeze/global_constants.py +++ b/dev/breeze/src/airflow_breeze/global_constants.py @@ -42,7 +42,7 @@ APACHE_AIRFLOW_GITHUB_REPOSITORY = "apache/airflow" # Checked before putting in build cache -ALLOWED_PYTHON_MAJOR_MINOR_VERSIONS = ["3.8", "3.9", "3.10", "3.11"] +ALLOWED_PYTHON_MAJOR_MINOR_VERSIONS = ["3.8", "3.9", "3.10", "3.11", "3.12"] DEFAULT_PYTHON_MAJOR_MINOR_VERSION = ALLOWED_PYTHON_MAJOR_MINOR_VERSIONS[0] ALLOWED_ARCHITECTURES = [Architecture.X86_64, Architecture.ARM] # Database Backends used when starting Breeze. The "none" value means that invalid configuration @@ -193,7 +193,7 @@ def all_helm_test_packages() -> list[str]: ALLOWED_USE_AIRFLOW_VERSIONS = ["none", "wheel", "sdist"] -ALL_HISTORICAL_PYTHON_VERSIONS = ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11"] +ALL_HISTORICAL_PYTHON_VERSIONS = ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] def get_default_platform_machine() -> str: @@ -219,7 +219,7 @@ def get_default_platform_machine() -> str: PYTHONDONTWRITEBYTECODE = True PRODUCTION_IMAGE = False -ALL_PYTHON_MAJOR_MINOR_VERSIONS = ["3.8", "3.9", "3.10", "3.11"] +ALL_PYTHON_MAJOR_MINOR_VERSIONS = ["3.8", "3.9", "3.10", "3.11", "3.12"] CURRENT_PYTHON_MAJOR_MINOR_VERSIONS = ALL_PYTHON_MAJOR_MINOR_VERSIONS CURRENT_POSTGRES_VERSIONS = ["12", "13", "14", "15", "16"] DEFAULT_POSTGRES_VERSION = CURRENT_POSTGRES_VERSIONS[0] @@ -267,6 +267,7 @@ def get_default_platform_machine() -> str: "2.7.1": ["3.8", "3.9", "3.10", "3.11"], "2.7.2": ["3.8", "3.9", "3.10", "3.11"], "2.7.3": ["3.8", "3.9", "3.10", "3.11"], + "2.8.0": ["3.8", "3.9", "3.10", "3.11"], } DB_RESET = False diff --git a/dev/breeze/src/airflow_breeze/utils/cdxgen.py b/dev/breeze/src/airflow_breeze/utils/cdxgen.py index 3bcb4cd21fed2..2f31a5fe070f7 100644 --- a/dev/breeze/src/airflow_breeze/utils/cdxgen.py +++ b/dev/breeze/src/airflow_breeze/utils/cdxgen.py @@ -282,6 +282,7 @@ def build_all_airflow_versions_base_image( "3.9": "e698dbfe25da10d09c5810938f586535633928a4", "3.10": "e698dbfe25da10d09c5810938f586535633928a4", "3.11": "e698dbfe25da10d09c5810938f586535633928a4", + "3.12": "e698dbfe25da10d09c5810938f586535633928a4", } """ image_name = get_all_airflow_versions_image_name(python_version=python_version) diff --git a/dev/breeze/tests/test_cache.py b/dev/breeze/tests/test_cache.py index 7032a21593756..52ba6ada1e09e 100644 --- a/dev/breeze/tests/test_cache.py +++ b/dev/breeze/tests/test_cache.py @@ -36,8 +36,8 @@ [ ("backend", "mysql", (True, ["sqlite", "mysql", "postgres", "none"]), None), ("backend", "xxx", (False, ["sqlite", "mysql", "postgres", "none"]), None), - ("python_major_minor_version", "3.8", (True, ["3.8", "3.9", "3.10", "3.11"]), None), - ("python_major_minor_version", "3.7", (False, ["3.8", "3.9", "3.10", "3.11"]), None), + ("python_major_minor_version", "3.8", (True, ["3.8", "3.9", "3.10", "3.11", "3.12"]), None), + ("python_major_minor_version", "3.7", (False, ["3.8", "3.9", "3.10", "3.11", "3.12"]), None), ("missing", "value", None, AttributeError), ], ) diff --git a/dev/breeze/tests/test_packages.py b/dev/breeze/tests/test_packages.py index 017a71e9d63e6..7beb1b7d1f35a 100644 --- a/dev/breeze/tests/test_packages.py +++ b/dev/breeze/tests/test_packages.py @@ -376,7 +376,7 @@ def test_provider_jinja_context(): "VERSION_SUFFIX": ".rc1", "PROVIDER_DESCRIPTION": "Amazon integration (including `Amazon Web Services (AWS) `__).\n", "CHANGELOG_RELATIVE_PATH": "../../airflow/providers/amazon", - "SUPPORTED_PYTHON_VERSIONS": ["3.8", "3.9", "3.10", "3.11"], + "SUPPORTED_PYTHON_VERSIONS": ["3.8", "3.9", "3.10", "3.11", "3.12"], "PLUGINS": [], "MIN_AIRFLOW_VERSION": "2.6.0", "PROVIDER_REMOVED": False, diff --git a/dev/breeze/tests/test_selective_checks.py b/dev/breeze/tests/test_selective_checks.py index e5dc42171233e..ad9d76cee52cf 100644 --- a/dev/breeze/tests/test_selective_checks.py +++ b/dev/breeze/tests/test_selective_checks.py @@ -429,10 +429,10 @@ def assert_outputs_are_printed(expected_outputs: dict[str, str], stderr: str): ("pyproject.toml",), { "affected-providers-list-as-string": ALL_PROVIDERS_AFFECTED, - "all-python-versions": "['3.8', '3.9', '3.10', '3.11']", - "all-python-versions-list-as-string": "3.8 3.9 3.10 3.11", - "python-versions": "['3.8', '3.9', '3.10', '3.11']", - "python-versions-list-as-string": "3.8 3.9 3.10 3.11", + "all-python-versions": "['3.8', '3.9', '3.10', '3.11', '3.12']", + "all-python-versions-list-as-string": "3.8 3.9 3.10 3.11 3.12", + "python-versions": "['3.8', '3.9', '3.10', '3.11', '3.12']", + "python-versions-list-as-string": "3.8 3.9 3.10 3.11 3.12", "ci-image-build": "true", "prod-image-build": "true", "needs-helm-tests": "true", @@ -455,10 +455,10 @@ def assert_outputs_are_printed(expected_outputs: dict[str, str], stderr: str): ("generated/provider_dependencies.json",), { "affected-providers-list-as-string": ALL_PROVIDERS_AFFECTED, - "all-python-versions": "['3.8', '3.9', '3.10', '3.11']", - "all-python-versions-list-as-string": "3.8 3.9 3.10 3.11", - "python-versions": "['3.8', '3.9', '3.10', '3.11']", - "python-versions-list-as-string": "3.8 3.9 3.10 3.11", + "all-python-versions": "['3.8', '3.9', '3.10', '3.11', '3.12']", + "all-python-versions-list-as-string": "3.8 3.9 3.10 3.11 3.12", + "python-versions": "['3.8', '3.9', '3.10', '3.11', '3.12']", + "python-versions-list-as-string": "3.8 3.9 3.10 3.11 3.12", "ci-image-build": "true", "prod-image-build": "true", "needs-helm-tests": "true", @@ -605,10 +605,10 @@ def test_expected_output_pull_request_main( "main", { "affected-providers-list-as-string": ALL_PROVIDERS_AFFECTED, - "all-python-versions": "['3.8', '3.9', '3.10', '3.11']", - "all-python-versions-list-as-string": "3.8 3.9 3.10 3.11", - "python-versions": "['3.8', '3.9', '3.10', '3.11']", - "python-versions-list-as-string": "3.8 3.9 3.10 3.11", + "all-python-versions": "['3.8', '3.9', '3.10', '3.11', '3.12']", + "all-python-versions-list-as-string": "3.8 3.9 3.10 3.11 3.12", + "python-versions": "['3.8', '3.9', '3.10', '3.11', '3.12']", + "python-versions-list-as-string": "3.8 3.9 3.10 3.11 3.12", "ci-image-build": "true", "prod-image-build": "true", "run-tests": "true", @@ -634,10 +634,10 @@ def test_expected_output_pull_request_main( "main", { "affected-providers-list-as-string": ALL_PROVIDERS_AFFECTED, - "all-python-versions": "['3.8', '3.9', '3.10', '3.11']", - "all-python-versions-list-as-string": "3.8 3.9 3.10 3.11", - "python-versions": "['3.8', '3.9', '3.10', '3.11']", - "python-versions-list-as-string": "3.8 3.9 3.10 3.11", + "all-python-versions": "['3.8', '3.9', '3.10', '3.11', '3.12']", + "all-python-versions-list-as-string": "3.8 3.9 3.10 3.11 3.12", + "python-versions": "['3.8', '3.9', '3.10', '3.11', '3.12']", + "python-versions-list-as-string": "3.8 3.9 3.10 3.11 3.12", "ci-image-build": "true", "prod-image-build": "true", "run-tests": "true", @@ -661,10 +661,10 @@ def test_expected_output_pull_request_main( "main", { "affected-providers-list-as-string": ALL_PROVIDERS_AFFECTED, - "all-python-versions": "['3.8', '3.9', '3.10', '3.11']", - "all-python-versions-list-as-string": "3.8 3.9 3.10 3.11", - "python-versions": "['3.8', '3.9', '3.10', '3.11']", - "python-versions-list-as-string": "3.8 3.9 3.10 3.11", + "all-python-versions": "['3.8', '3.9', '3.10', '3.11', '3.12']", + "all-python-versions-list-as-string": "3.8 3.9 3.10 3.11 3.12", + "python-versions": "['3.8', '3.9', '3.10', '3.11', '3.12']", + "python-versions-list-as-string": "3.8 3.9 3.10 3.11 3.12", "ci-image-build": "true", "prod-image-build": "true", "run-tests": "true", @@ -688,10 +688,10 @@ def test_expected_output_pull_request_main( "v2-7-stable", { "affected-providers-list-as-string": ALL_PROVIDERS_AFFECTED, - "all-python-versions": "['3.8', '3.9', '3.10', '3.11']", - "all-python-versions-list-as-string": "3.8 3.9 3.10 3.11", - "python-versions": "['3.8', '3.9', '3.10', '3.11']", - "python-versions-list-as-string": "3.8 3.9 3.10 3.11", + "all-python-versions": "['3.8', '3.9', '3.10', '3.11', '3.12']", + "all-python-versions-list-as-string": "3.8 3.9 3.10 3.11 3.12", + "python-versions": "['3.8', '3.9', '3.10', '3.11', '3.12']", + "python-versions-list-as-string": "3.8 3.9 3.10 3.11 3.12", "ci-image-build": "true", "prod-image-build": "true", "run-tests": "true", @@ -1037,8 +1037,8 @@ def test_expected_output_pull_request_target( "main", { "affected-providers-list-as-string": ALL_PROVIDERS_AFFECTED, - "all-python-versions": "['3.8', '3.9', '3.10', '3.11']", - "all-python-versions-list-as-string": "3.8 3.9 3.10 3.11", + "all-python-versions": "['3.8', '3.9', '3.10', '3.11', '3.12']", + "all-python-versions-list-as-string": "3.8 3.9 3.10 3.11 3.12", "ci-image-build": "true", "prod-image-build": "true", "needs-helm-tests": "true", @@ -1059,8 +1059,8 @@ def test_expected_output_pull_request_target( "v2-3-stable", { "affected-providers-list-as-string": ALL_PROVIDERS_AFFECTED, - "all-python-versions": "['3.8', '3.9', '3.10', '3.11']", - "all-python-versions-list-as-string": "3.8 3.9 3.10 3.11", + "all-python-versions": "['3.8', '3.9', '3.10', '3.11', '3.12']", + "all-python-versions-list-as-string": "3.8 3.9 3.10 3.11 3.12", "ci-image-build": "true", "prod-image-build": "true", "needs-helm-tests": "false", @@ -1083,8 +1083,8 @@ def test_expected_output_pull_request_target( "main", { "affected-providers-list-as-string": ALL_PROVIDERS_AFFECTED, - "all-python-versions": "['3.8', '3.9', '3.10', '3.11']", - "all-python-versions-list-as-string": "3.8 3.9 3.10 3.11", + "all-python-versions": "['3.8', '3.9', '3.10', '3.11', '3.12']", + "all-python-versions-list-as-string": "3.8 3.9 3.10 3.11 3.12", "ci-image-build": "true", "prod-image-build": "true", "needs-helm-tests": "true", @@ -1137,8 +1137,8 @@ def test_no_commit_provided_trigger_full_build_for_any_event_type(github_event): ) assert_outputs_are_printed( { - "all-python-versions": "['3.8', '3.9', '3.10', '3.11']", - "all-python-versions-list-as-string": "3.8 3.9 3.10 3.11", + "all-python-versions": "['3.8', '3.9', '3.10', '3.11', '3.12']", + "all-python-versions-list-as-string": "3.8 3.9 3.10 3.11 3.12", "ci-image-build": "true", "prod-image-build": "true", "needs-helm-tests": "true", diff --git a/dev/retag_docker_images.py b/dev/retag_docker_images.py index bbf63fab1344a..208e8eeb30e34 100755 --- a/dev/retag_docker_images.py +++ b/dev/retag_docker_images.py @@ -32,7 +32,7 @@ import rich_click as click -PYTHON_VERSIONS = ["3.8", "3.9", "3.10", "3.11"] +PYTHON_VERSIONS = ["3.8", "3.9", "3.10", "3.11", "3.12"] GHCR_IO_PREFIX = "ghcr.io" diff --git a/pyproject.toml b/pyproject.toml index 65730eac15df4..20fd2b88ff500 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1249,7 +1249,7 @@ artifacts = [ [tool.black] line-length = 110 -target-version = ['py38', 'py39', 'py310', 'py311'] +target-version = ['py38', 'py39', 'py310', 'py311', 'py312'] [tool.ruff] target-version = "py38"