This is an automated email from the ASF dual-hosted git repository. jscheffl pushed a commit to branch feature/drop-python3.8-support-core-and-providers-v2-10-backport in repository https://gitbox.apache.org/repos/asf/airflow.git
commit 4463c2b06e452d280eed2ceb71bb5fafe324fa83 Author: Jens Scheffler <[email protected]> AuthorDate: Fri Oct 4 14:48:45 2024 +0200 Drop Python 3.8 support in provider packages (cherry picked from commit 5de5ca73794a80d4a6f998d55d793baa319275fb) (cherry picked from commit 526948f01d73da8f177977ede3e076a36b226498) --- airflow/providers/MANAGING_PROVIDERS_LIFECYCLE.rst | 2 +- airflow/providers/amazon/aws/utils/mixins.py | 3 +-- airflow/providers/cloudant/provider.yaml | 11 +++++++++-- .../cncf/kubernetes/kubernetes_helper_functions.py | 2 +- airflow/providers/common/io/xcom/backend.py | 21 +++------------------ airflow/providers/openlineage/conf.py | 2 +- .../executors/general.rst | 6 +++--- generated/provider_dependencies.json | 8 +++++--- 8 files changed, 24 insertions(+), 31 deletions(-) diff --git a/airflow/providers/MANAGING_PROVIDERS_LIFECYCLE.rst b/airflow/providers/MANAGING_PROVIDERS_LIFECYCLE.rst index 48980f2153c..3d3e95c28b1 100644 --- a/airflow/providers/MANAGING_PROVIDERS_LIFECYCLE.rst +++ b/airflow/providers/MANAGING_PROVIDERS_LIFECYCLE.rst @@ -454,7 +454,7 @@ If you have pre-commit installed, pre-commit will be run automatically on commit manually after commit, you can run it via ``breeze static-checks --last-commit`` some of the tests might fail because suspension of the provider might cause changes in the dependencies, so if you see errors about missing dependencies imports, non-usable classes etc., you will need to build the CI image locally -via ``breeze build-image --python 3.8 --upgrade-to-newer-dependencies`` after the first pre-commit run +via ``breeze build-image --python 3.9 --upgrade-to-newer-dependencies`` after the first pre-commit run and then run the static checks again. If you want to be absolutely sure to run all static checks you can always do this via diff --git a/airflow/providers/amazon/aws/utils/mixins.py b/airflow/providers/amazon/aws/utils/mixins.py index b9c7e30c23d..fc191d5b740 100644 --- a/airflow/providers/amazon/aws/utils/mixins.py +++ b/airflow/providers/amazon/aws/utils/mixins.py @@ -28,13 +28,12 @@ This module contains different mixin classes for internal use within the Amazon from __future__ import annotations import warnings -from functools import cached_property +from functools import cache, cached_property from typing import Any, Generic, NamedTuple, TypeVar from deprecated import deprecated from typing_extensions import final -from airflow.compat.functools import cache from airflow.exceptions import AirflowProviderDeprecationWarning from airflow.providers.amazon.aws.hooks.base_aws import AwsGenericHook diff --git a/airflow/providers/cloudant/provider.yaml b/airflow/providers/cloudant/provider.yaml index 3b6dc2727c8..e02612fbd97 100644 --- a/airflow/providers/cloudant/provider.yaml +++ b/airflow/providers/cloudant/provider.yaml @@ -44,8 +44,15 @@ versions: - 1.0.0 dependencies: - - apache-airflow>=2.7.0 - - cloudant>=2.13.0 + - apache-airflow>=2.8.0 + - ibmcloudant>=0.9.1 + +excluded-python-versions: + # ibmcloudant transitively brings in urllib3 2.x, but the snowflake provider has a dependency that pins + # urllib3 to 1.x on Python 3.9; thus we exclude those Python versions from taking the update + # to ibmcloudant. + # See #21004, #41555, and https://github.com/snowflakedb/snowflake-connector-python/issues/2016 + - "3.9" integrations: - integration-name: IBM Cloudant diff --git a/airflow/providers/cncf/kubernetes/kubernetes_helper_functions.py b/airflow/providers/cncf/kubernetes/kubernetes_helper_functions.py index d337caf14c1..c603f8a178b 100644 --- a/airflow/providers/cncf/kubernetes/kubernetes_helper_functions.py +++ b/airflow/providers/cncf/kubernetes/kubernetes_helper_functions.py @@ -19,6 +19,7 @@ from __future__ import annotations import logging import secrets import string +from functools import cache from typing import TYPE_CHECKING import pendulum @@ -26,7 +27,6 @@ from deprecated import deprecated from kubernetes.client.rest import ApiException from slugify import slugify -from airflow.compat.functools import cache from airflow.configuration import conf from airflow.exceptions import AirflowProviderDeprecationWarning diff --git a/airflow/providers/common/io/xcom/backend.py b/airflow/providers/common/io/xcom/backend.py index af55baa4c06..256b503181e 100644 --- a/airflow/providers/common/io/xcom/backend.py +++ b/airflow/providers/common/io/xcom/backend.py @@ -19,12 +19,13 @@ from __future__ import annotations import contextlib import json import uuid +from functools import cache +from pathlib import Path from typing import TYPE_CHECKING, Any, TypeVar from urllib.parse import urlsplit import fsspec.utils -from airflow.compat.functools import cache from airflow.configuration import conf from airflow.io.path import ObjectStoragePath from airflow.models.xcom import BaseXCom @@ -40,22 +41,6 @@ T = TypeVar("T") SECTION = "common.io" -def _is_relative_to(o: ObjectStoragePath, other: ObjectStoragePath) -> bool: - """ - Return whether or not this path is relative to the other path. - - This is a port of the pathlib.Path.is_relative_to method. It is not available in python 3.8. - """ - if hasattr(o, "is_relative_to"): - return o.is_relative_to(other) - - try: - o.relative_to(other) - return True - except ValueError: - return False - - def _get_compression_suffix(compression: str) -> str: """ Return the compression suffix for the given compression. @@ -111,7 +96,7 @@ class XComObjectStorageBackend(BaseXCom): raise TypeError(f"Not a valid url: {data}") from None if url.scheme: - if not _is_relative_to(ObjectStoragePath(data), p): + if not Path.is_relative_to(ObjectStoragePath(data), p): raise ValueError(f"Invalid key: {data}") return p / data.replace(str(p), "", 1).lstrip("/") diff --git a/airflow/providers/openlineage/conf.py b/airflow/providers/openlineage/conf.py index 562b673ed5e..bcb71c78862 100644 --- a/airflow/providers/openlineage/conf.py +++ b/airflow/providers/openlineage/conf.py @@ -35,7 +35,7 @@ if os.getenv("PYTEST_VERSION"): cache = decorator else: - from airflow.compat.functools import cache + from functools import cache from airflow.configuration import conf _CONFIG_SECTION = "openlineage" diff --git a/docs/apache-airflow-providers-amazon/executors/general.rst b/docs/apache-airflow-providers-amazon/executors/general.rst index 94d0248008a..0410e872770 100644 --- a/docs/apache-airflow-providers-amazon/executors/general.rst +++ b/docs/apache-airflow-providers-amazon/executors/general.rst @@ -138,9 +138,9 @@ which is running the Airflow scheduler process (and thus, the |executorName| executor.) Apache Airflow images with specific python versions can be downloaded from the Dockerhub registry, and filtering tags by the `python -version <https://hub.docker.com/r/apache/airflow/tags?page=1&name=3.8>`__. -For example, the tag ``latest-python3.8`` specifies that the image will -have python 3.8 installed. +version <https://hub.docker.com/r/apache/airflow/tags?page=1&name=3.9>`__. +For example, the tag ``latest-python3.9`` specifies that the image will +have python 3.9 installed. Loading DAGs diff --git a/generated/provider_dependencies.json b/generated/provider_dependencies.json index 1ac11366c64..83e294a423a 100644 --- a/generated/provider_dependencies.json +++ b/generated/provider_dependencies.json @@ -352,13 +352,15 @@ }, "cloudant": { "deps": [ - "apache-airflow>=2.7.0", - "cloudant>=2.13.0" + "apache-airflow>=2.8.0", + "ibmcloudant>=0.9.1" ], "devel-deps": [], "plugins": [], "cross-providers-deps": [], - "excluded-python-versions": [], + "excluded-python-versions": [ + "3.9" + ], "state": "ready" }, "cncf.kubernetes": {
