Skip to content

Commit 00a6889

Browse files
committed
Remove unnecessary compatibility code in S3 asset import
The S3 asset import had a conditional code to import assets but it is unnecessary, because the compatibility code is added to common.compat provider - but only in the upcoming version so we have to make sure that common.compat is added to "chicken-egg" providers, so that constaraints are properly generated for PyPI packages. This is also the case where we can bump manually provider version without waiting for release time - because we need to depend on the new provider version in amazon provider.
1 parent 98e0977 commit 00a6889

File tree

5 files changed

+5
-20
lines changed

5 files changed

+5
-20
lines changed

dev/breeze/src/airflow_breeze/global_constants.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -607,7 +607,7 @@ def get_airflow_extras():
607607
# END OF EXTRAS LIST UPDATED BY PRE COMMIT
608608
]
609609

610-
CHICKEN_EGG_PROVIDERS = " ".join(["standard amazon common.sql"])
610+
CHICKEN_EGG_PROVIDERS = " ".join(["common.compat"])
611611

612612

613613
PROVIDERS_COMPATIBILITY_TESTS_MATRIX: list[dict[str, str | list[str]]] = [

generated/provider_dependencies.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"amazon": {
2727
"deps": [
2828
"PyAthena>=3.0.10",
29-
"apache-airflow-providers-common-compat>=1.2.1",
29+
"apache-airflow-providers-common-compat>=1.3.0",
3030
"apache-airflow-providers-common-sql>=1.20.0",
3131
"apache-airflow-providers-http",
3232
"apache-airflow>=2.8.0",

providers/src/airflow/providers/amazon/aws/assets/s3.py

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -19,30 +19,14 @@
1919
from typing import TYPE_CHECKING
2020

2121
from airflow.providers.amazon.aws.hooks.s3 import S3Hook
22+
from airflow.providers.common.compat.assets import Asset
2223

2324
if TYPE_CHECKING:
2425
from urllib.parse import SplitResult
2526

26-
from airflow.providers.common.compat.assets import Asset
2727
from airflow.providers.common.compat.openlineage.facet import (
2828
Dataset as OpenLineageDataset,
2929
)
30-
else:
31-
# TODO: Remove this try-exception block after bumping common provider to 1.3.0
32-
# This is due to common provider AssetDetails import error handling
33-
try:
34-
from airflow.providers.common.compat.assets import Asset
35-
except ImportError:
36-
from packaging.version import Version
37-
38-
from airflow import __version__ as AIRFLOW_VERSION
39-
40-
AIRFLOW_V_3_0_PLUS = Version(Version(AIRFLOW_VERSION).base_version) >= Version("3.0.0")
41-
if AIRFLOW_V_3_0_PLUS:
42-
from airflow.sdk.definitions.asset import Asset
43-
else:
44-
# dataset is renamed to asset since Airflow 3.0
45-
from airflow.datasets import Dataset as Asset
4630

4731

4832
def create_asset(*, bucket: str, key: str, extra=None) -> Asset:

providers/src/airflow/providers/amazon/provider.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ versions:
9494

9595
dependencies:
9696
- apache-airflow>=2.8.0
97-
- apache-airflow-providers-common-compat>=1.2.1
97+
- apache-airflow-providers-common-compat>=1.3.0
9898
- apache-airflow-providers-common-sql>=1.20.0
9999
- apache-airflow-providers-http
100100
# We should update minimum version of boto3 and here regularly to avoid `pip` backtracking with the number

providers/src/airflow/providers/common/compat/provider.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ state: ready
2525
source-date-epoch: 1731569875
2626
# note that those versions are maintained by release manager - do not update them manually
2727
versions:
28+
- 1.3.0
2829
- 1.2.2
2930
- 1.2.1
3031
- 1.2.0

0 commit comments

Comments
 (0)