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

potiuk pushed a commit to branch python3.12
in repository https://gitbox.apache.org/repos/asf/airflow.git

commit 52a6fdc71d6f9eaa386e6543338540abfa588ad4
Author: dirrao <[email protected]>
AuthorDate: Fri Jan 12 13:30:52 2024 +0530

    python 3.12 support
---
 airflow/__init__.py                               |  1 +
 dev/README_RELEASE_AIRFLOW.md                     |  2 +-
 dev/breeze/pyproject.toml                         |  2 +-
 dev/breeze/src/airflow_breeze/global_constants.py |  7 +--
 dev/breeze/src/airflow_breeze/utils/cdxgen.py     |  1 +
 dev/breeze/tests/test_cache.py                    |  4 +-
 dev/breeze/tests/test_packages.py                 |  2 +-
 dev/breeze/tests/test_selective_checks.py         | 64 +++++++++++------------
 dev/retag_docker_images.py                        |  2 +-
 pyproject.toml                                    |  2 +-
 10 files changed, 45 insertions(+), 42 deletions(-)

diff --git a/airflow/__init__.py b/airflow/__init__.py
index 4af74a44d2..3df4a11cb1 100644
--- a/airflow/__init__.py
+++ b/airflow/__init__.py
@@ -75,6 +75,7 @@ PY38 = sys.version_info >= (3, 8)
 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 6b51c9189f..faa4d1fd4c 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/pyproject.toml b/dev/breeze/pyproject.toml
index 438719faa7..2c8f96ad1d 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 ef1217acd7..9858b1de54 100644
--- a/dev/breeze/src/airflow_breeze/global_constants.py
+++ b/dev/breeze/src/airflow_breeze/global_constants.py
@@ -42,7 +42,7 @@ ANSWER = ""
 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 @@ ALLOWED_PLATFORMS = [*SINGLE_PLATFORMS, MULTI_PLATFORM]
 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 @@ SQLITE_URL = "sqlite:////root/airflow/sqlite/airflow.db"
 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 @@ AIRFLOW_PYTHON_COMPATIBILITY_MATRIX = {
     "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 3bcb4cd21f..2f31a5fe07 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 7032a21593..52ba6ada1e 100644
--- a/dev/breeze/tests/test_cache.py
+++ b/dev/breeze/tests/test_cache.py
@@ -36,8 +36,8 @@ AIRFLOW_SOURCES = Path(__file__).parents[3].resolve()
     [
         ("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 017a71e9d6..7beb1b7d1f 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) <https://aws.amazon.com/>`__).\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 e5dc421712..ad9d76cee5 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 bbf63fab13..208e8eeb30 100755
--- a/dev/retag_docker_images.py
+++ b/dev/retag_docker_images.py
@@ -32,7 +32,7 @@ import subprocess
 
 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 0d558a7a34..61857ecb8c 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1247,7 +1247,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"

Reply via email to