apache-airflow-providers-common-compat 1.5.1__py3-none-any.whl → 1.6.0b1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of apache-airflow-providers-common-compat might be problematic. Click here for more details.

@@ -29,7 +29,7 @@ from airflow import __version__ as airflow_version
29
29
 
30
30
  __all__ = ["__version__"]
31
31
 
32
- __version__ = "1.5.1"
32
+ __version__ = "1.6.0b1"
33
33
 
34
34
  if packaging.version.parse(packaging.version.parse(airflow_version).base_version) < packaging.version.parse(
35
35
  "2.9.0"
@@ -25,12 +25,12 @@ from airflow.providers.common.compat.version_compat import (
25
25
  )
26
26
 
27
27
  if TYPE_CHECKING:
28
- from airflow.api_fastapi.auth.managers.models.resource_details import AssetDetails
28
+ from airflow.api_fastapi.auth.managers.models.resource_details import AssetAliasDetails, AssetDetails
29
29
  from airflow.models.asset import expand_alias_to_assets
30
30
  from airflow.sdk.definitions.asset import Asset, AssetAlias, AssetAll, AssetAny
31
31
  else:
32
32
  if AIRFLOW_V_3_0_PLUS:
33
- from airflow.api_fastapi.auth.managers.models.resource_details import AssetDetails
33
+ from airflow.api_fastapi.auth.managers.models.resource_details import AssetAliasDetails, AssetDetails
34
34
  from airflow.models.asset import expand_alias_to_assets
35
35
  from airflow.sdk.definitions.asset import Asset, AssetAlias, AssetAll, AssetAny
36
36
  else:
@@ -52,6 +52,7 @@ else:
52
52
  __all__ = [
53
53
  "Asset",
54
54
  "AssetAlias",
55
+ "AssetAliasDetails",
55
56
  "AssetAll",
56
57
  "AssetAny",
57
58
  "AssetDetails",
@@ -0,0 +1,99 @@
1
+ # Licensed to the Apache Software Foundation (ASF) under one
2
+ # or more contributor license agreements. See the NOTICE file
3
+ # distributed with this work for additional information
4
+ # regarding copyright ownership. The ASF licenses this file
5
+ # to you under the Apache License, Version 2.0 (the
6
+ # "License"); you may not use this file except in compliance
7
+ # with the License. You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
17
+
18
+ from __future__ import annotations
19
+
20
+ import functools
21
+ import importlib
22
+ from importlib import metadata
23
+
24
+ from packaging.version import Version
25
+
26
+ from airflow.exceptions import AirflowOptionalProviderFeatureException
27
+
28
+
29
+ def require_provider_version(provider_name: str, provider_min_version: str):
30
+ """
31
+ Enforce minimum version requirement for a specific provider.
32
+
33
+ Some providers, do not explicitly require other provider packages but may offer optional features
34
+ that depend on it. These features are generally available starting from a specific version of such
35
+ provider. This decorator helps ensure compatibility, preventing import errors and providing clear
36
+ logs about version requirements.
37
+
38
+ Args:
39
+ provider_name: Name of the provider e.g., apache-airflow-providers-openlineage
40
+ provider_min_version: Optional minimum version requirement e.g., 1.0.1
41
+
42
+ Raises:
43
+ ValueError: If neither `provider_name` nor `provider_min_version` is provided.
44
+ ValueError: If full provider name (e.g., apache-airflow-providers-openlineage) is not provided.
45
+ TypeError: If the decorator is used without parentheses (e.g., `@require_provider_version`).
46
+ """
47
+ err_msg = (
48
+ "`require_provider_version` decorator must be used with two arguments: "
49
+ "'provider_name' and 'provider_min_version', "
50
+ 'e.g., @require_provider_version(provider_name="apache-airflow-providers-openlineage", '
51
+ 'provider_min_version="1.0.0")'
52
+ )
53
+ # Detect if decorator is mistakenly used without arguments
54
+ if callable(provider_name) and not provider_min_version:
55
+ raise TypeError(err_msg)
56
+
57
+ # Ensure both arguments are provided and not empty
58
+ if not provider_name or not provider_min_version:
59
+ raise ValueError(err_msg)
60
+
61
+ # Ensure full provider name is passed
62
+ if not provider_name.startswith("apache-airflow-providers-"):
63
+ raise ValueError(
64
+ f"Full `provider_name` must be provided starting with 'apache-airflow-providers-', "
65
+ f"got `{provider_name}`."
66
+ )
67
+
68
+ def decorator(func):
69
+ @functools.wraps(func)
70
+ def wrapper(*args, **kwargs):
71
+ try:
72
+ provider_version: str = metadata.version(provider_name)
73
+ except metadata.PackageNotFoundError:
74
+ try:
75
+ # Try dynamically importing the provider module based on the provider name
76
+ import_provider_name = provider_name.replace("apache-airflow-providers-", "").replace(
77
+ "-", "."
78
+ )
79
+ provider_module = importlib.import_module(f"airflow.providers.{import_provider_name}")
80
+
81
+ provider_version = getattr(provider_module, "__version__")
82
+
83
+ except (ImportError, AttributeError, ModuleNotFoundError):
84
+ raise AirflowOptionalProviderFeatureException(
85
+ f"Provider `{provider_name}` not found or has no version, "
86
+ f"skipping function `{func.__name__}` execution"
87
+ )
88
+
89
+ if provider_version and Version(provider_version) < Version(provider_min_version):
90
+ raise AirflowOptionalProviderFeatureException(
91
+ f"Provider's `{provider_name}` version `{provider_version}` is lower than required "
92
+ f"`{provider_min_version}`, skipping function `{func.__name__}` execution"
93
+ )
94
+
95
+ return func(*args, **kwargs)
96
+
97
+ return wrapper
98
+
99
+ return decorator
@@ -27,8 +27,8 @@ def get_provider_info():
27
27
  "name": "Common Compat",
28
28
  "description": "``Common Compatibility Provider - providing compatibility code for previous Airflow versions.``\n",
29
29
  "state": "ready",
30
- "source-date-epoch": 1741508595,
31
- "versions": ["1.5.1", "1.5.0", "1.3.0", "1.2.2", "1.2.1", "1.2.0", "1.1.0", "1.0.0"],
30
+ "source-date-epoch": 1742480214,
31
+ "versions": ["1.6.0b1", "1.5.1", "1.5.0", "1.3.0", "1.2.2", "1.2.1", "1.2.0", "1.1.0", "1.0.0"],
32
32
  "integrations": [
33
33
  {
34
34
  "integration-name": "Common Compat",
@@ -0,0 +1,104 @@
1
+ # Licensed to the Apache Software Foundation (ASF) under one
2
+ # or more contributor license agreements. See the NOTICE file
3
+ # distributed with this work for additional information
4
+ # regarding copyright ownership. The ASF licenses this file
5
+ # to you under the Apache License, Version 2.0 (the
6
+ # "License"); you may not use this file except in compliance
7
+ # with the License. You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
17
+
18
+ from __future__ import annotations
19
+
20
+ import functools
21
+ import logging
22
+ from importlib import metadata
23
+
24
+ from packaging.version import Version
25
+
26
+ from airflow.exceptions import AirflowOptionalProviderFeatureException
27
+
28
+ log = logging.getLogger(__name__)
29
+
30
+
31
+ def require_openlineage_version(
32
+ provider_min_version: str | None = None, client_min_version: str | None = None
33
+ ):
34
+ """
35
+ Enforce minimum version requirements for OpenLineage provider or client.
36
+
37
+ Some providers, such as Snowflake and DBT Cloud, do not require an OpenLineage provider but may
38
+ offer optional features that depend on it. These features are generally available starting
39
+ from a specific version of the OpenLineage provider or client. This decorator helps ensure compatibility,
40
+ preventing import errors and providing clear logs about version requirements.
41
+
42
+ Args:
43
+ provider_min_version: Optional minimum version requirement for apache-airflow-providers-openlineage
44
+ client_min_version: Optional minimum version requirement for openlineage-python
45
+
46
+ Raises:
47
+ ValueError: If neither `provider_min_version` nor `client_min_version` is provided.
48
+ TypeError: If the decorator is used without parentheses (e.g., `@require_openlineage_version`).
49
+ """
50
+ err_msg = (
51
+ "`require_openlineage_version` decorator must be used with at least one argument: "
52
+ "'provider_min_version' or 'client_min_version', "
53
+ 'e.g., @require_openlineage_version(provider_min_version="1.0.0")'
54
+ )
55
+ # Detect if decorator is mistakenly used without arguments
56
+ if callable(provider_min_version) and client_min_version is None:
57
+ raise TypeError(err_msg)
58
+
59
+ # Ensure at least one argument is provided
60
+ if provider_min_version is None and client_min_version is None:
61
+ raise ValueError(err_msg)
62
+
63
+ def decorator(func):
64
+ @functools.wraps(func)
65
+ def wrapper(*args, **kwargs):
66
+ if provider_min_version:
67
+ try:
68
+ provider_version: str = metadata.version("apache-airflow-providers-openlineage")
69
+ except metadata.PackageNotFoundError:
70
+ try:
71
+ from airflow.providers.openlineage import __version__ as provider_version
72
+ except (ImportError, AttributeError, ModuleNotFoundError):
73
+ raise AirflowOptionalProviderFeatureException(
74
+ "OpenLineage provider not found or has no version, "
75
+ f"skipping function `{func.__name__}` execution"
76
+ )
77
+
78
+ if provider_version and Version(provider_version) < Version(provider_min_version):
79
+ raise AirflowOptionalProviderFeatureException(
80
+ f"OpenLineage provider version `{provider_version}` "
81
+ f"is lower than required `{provider_min_version}`, "
82
+ f"skipping function `{func.__name__}` execution"
83
+ )
84
+
85
+ if client_min_version:
86
+ try:
87
+ client_version: str = metadata.version("openlineage-python")
88
+ except metadata.PackageNotFoundError:
89
+ raise AirflowOptionalProviderFeatureException(
90
+ f"OpenLineage client not found, skipping function `{func.__name__}` execution"
91
+ )
92
+
93
+ if client_version and Version(client_version) < Version(client_min_version):
94
+ raise AirflowOptionalProviderFeatureException(
95
+ f"OpenLineage client version `{client_version}` "
96
+ f"is lower than required `{client_min_version}`, "
97
+ f"skipping function `{func.__name__}` execution"
98
+ )
99
+
100
+ return func(*args, **kwargs)
101
+
102
+ return wrapper
103
+
104
+ return decorator
@@ -19,12 +19,22 @@ from __future__ import annotations
19
19
  from typing import TYPE_CHECKING
20
20
 
21
21
  if TYPE_CHECKING:
22
- from airflow.security.permissions import RESOURCE_ASSET
22
+ from airflow.security.permissions import (
23
+ RESOURCE_ASSET,
24
+ RESOURCE_ASSET_ALIAS,
25
+ RESOURCE_BACKFILL,
26
+ RESOURCE_DAG_VERSION,
27
+ )
23
28
  else:
24
29
  try:
25
- from airflow.security.permissions import RESOURCE_ASSET
30
+ from airflow.security.permissions import (
31
+ RESOURCE_ASSET,
32
+ RESOURCE_ASSET_ALIAS,
33
+ RESOURCE_BACKFILL,
34
+ RESOURCE_DAG_VERSION,
35
+ )
26
36
  except ImportError:
27
37
  from airflow.security.permissions import RESOURCE_DATASET as RESOURCE_ASSET
28
38
 
29
39
 
30
- __all__ = ["RESOURCE_ASSET"]
40
+ __all__ = ["RESOURCE_ASSET", "RESOURCE_ASSET_ALIAS", "RESOURCE_BACKFILL", "RESOURCE_DAG_VERSION"]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: apache-airflow-providers-common-compat
3
- Version: 1.5.1
3
+ Version: 1.6.0b1
4
4
  Summary: Provider package apache-airflow-providers-common-compat for Apache Airflow
5
5
  Keywords: airflow-provider,common.compat,airflow,integration
6
6
  Author-email: Apache Software Foundation <dev@airflow.apache.org>
@@ -24,11 +24,11 @@ Requires-Dist: apache-airflow>=2.9.0
24
24
  Requires-Dist: apache-airflow-providers-openlineage ; extra == "openlineage"
25
25
  Requires-Dist: apache-airflow-providers-standard ; extra == "standard"
26
26
  Project-URL: Bug Tracker, https://github.com/apache/airflow/issues
27
- Project-URL: Changelog, https://airflow.apache.org/docs/apache-airflow-providers-common-compat/1.5.1/changelog.html
28
- Project-URL: Documentation, https://airflow.apache.org/docs/apache-airflow-providers-common-compat/1.5.1
27
+ Project-URL: Changelog, https://airflow.apache.org/docs/apache-airflow-providers-common-compat/1.6.0b1/changelog.html
28
+ Project-URL: Documentation, https://airflow.apache.org/docs/apache-airflow-providers-common-compat/1.6.0b1
29
+ Project-URL: Mastodon, https://fosstodon.org/@airflow
29
30
  Project-URL: Slack Chat, https://s.apache.org/airflow-slack
30
31
  Project-URL: Source Code, https://github.com/apache/airflow
31
- Project-URL: Twitter, https://x.com/ApacheAirflow
32
32
  Project-URL: YouTube, https://www.youtube.com/channel/UCSXwxpWZQ7XZ1WL3wqevChA/
33
33
  Provides-Extra: openlineage
34
34
  Provides-Extra: standard
@@ -58,7 +58,7 @@ Provides-Extra: standard
58
58
 
59
59
  Package ``apache-airflow-providers-common-compat``
60
60
 
61
- Release: ``1.5.1``
61
+ Release: ``1.6.0b1``
62
62
 
63
63
 
64
64
  ``Common Compatibility Provider - providing compatibility code for previous Airflow versions.``
@@ -71,7 +71,7 @@ This is a provider package for ``common.compat`` provider. All classes for this
71
71
  are in ``airflow.providers.common.compat`` python package.
72
72
 
73
73
  You can find package information and changelog for the provider
74
- in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-common-compat/1.5.1/>`_.
74
+ in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-common-compat/1.6.0b1/>`_.
75
75
 
76
76
  Installation
77
77
  ------------
@@ -112,5 +112,5 @@ Dependent package
112
112
  ============================================================================================================== ===============
113
113
 
114
114
  The changelog for the provider package can be found in the
115
- `changelog <https://airflow.apache.org/docs/apache-airflow-providers-common-compat/1.5.1/changelog.html>`_.
115
+ `changelog <https://airflow.apache.org/docs/apache-airflow-providers-common-compat/1.6.0b1/changelog.html>`_.
116
116
 
@@ -1,24 +1,26 @@
1
1
  airflow/providers/common/compat/LICENSE,sha256=gXPVwptPlW1TJ4HSuG5OMPg-a3h43OGMkZRR1rpwfJA,10850
2
- airflow/providers/common/compat/__init__.py,sha256=9pojwjD9RNKmRIpvk52S9ODVrjNcEQmCu6Yo5zOYI6U,1500
3
- airflow/providers/common/compat/get_provider_info.py,sha256=p01aEJ5_Q64paemTfOTuMpCgbJeMYDzp6sfecI2D5h0,1984
2
+ airflow/providers/common/compat/__init__.py,sha256=sysV2TNsvQETL5H5doqH9-9iUlzC9OvfBX9eqwRw29g,1502
3
+ airflow/providers/common/compat/check.py,sha256=d6at8iFn_c2jbnmvswoMYz1DFUrAbQTVKMCA5PYAOrQ,4347
4
+ airflow/providers/common/compat/get_provider_info.py,sha256=4DGFXh_Yb0imhgcsXvNq3E6FnmFI3lmlxSsroH49OUU,1995
4
5
  airflow/providers/common/compat/version_compat.py,sha256=aHg90_DtgoSnQvILFICexMyNlHlALBdaeWqkX3dFDug,1605
5
- airflow/providers/common/compat/assets/__init__.py,sha256=LvASyTEFy2ev0deaM7wJrxC6quKfHYaub69UTzzY8GE,2139
6
+ airflow/providers/common/compat/assets/__init__.py,sha256=73zbqrAVBepkL83xpjRjzLQF7LzI-uA-3pBu5n7-g80,2202
6
7
  airflow/providers/common/compat/lineage/__init__.py,sha256=9hdXHABrVpkbpjZgUft39kOFL2xSGeG4GEua0Hmelus,785
7
8
  airflow/providers/common/compat/lineage/entities.py,sha256=otob45spY8YSa5fMx3XXg-JWNZttS8g4WrkvYte2HFY,2651
8
9
  airflow/providers/common/compat/lineage/hook.py,sha256=0ujOAFXc3U0zqAJfKVgSRAHCa6lKwlNd7yMacUyNdD8,3977
9
10
  airflow/providers/common/compat/openlineage/__init__.py,sha256=9hdXHABrVpkbpjZgUft39kOFL2xSGeG4GEua0Hmelus,785
11
+ airflow/providers/common/compat/openlineage/check.py,sha256=jcrz1xgqsUd9TCF564U_JGvU8Vyrss7qpiMaQz_ZIqA,4672
10
12
  airflow/providers/common/compat/openlineage/facet.py,sha256=_3YHsRP39vx6FPePFQCLjNHP9kzisNH5v97o-PWzwLk,6529
11
13
  airflow/providers/common/compat/openlineage/utils/__init__.py,sha256=9hdXHABrVpkbpjZgUft39kOFL2xSGeG4GEua0Hmelus,785
12
14
  airflow/providers/common/compat/openlineage/utils/spark.py,sha256=zyvuWFLye_6xDmC4PDQ9NKi0muH-QtqfsqRIHNjxzRQ,5983
13
15
  airflow/providers/common/compat/openlineage/utils/sql.py,sha256=bQdfjBgkHNt0cFKdA2BM7myapb_WVM_F2RkVoPZVfoU,3286
14
16
  airflow/providers/common/compat/openlineage/utils/utils.py,sha256=KB_1emJIEeYxPG7YscYHmIEDIx9VNmUPtDFz81UuhQk,1617
15
17
  airflow/providers/common/compat/security/__init__.py,sha256=9hdXHABrVpkbpjZgUft39kOFL2xSGeG4GEua0Hmelus,785
16
- airflow/providers/common/compat/security/permissions.py,sha256=krHlEyXJHFOan1lhiRIuEUpEdS2qhOkwkJyvjWEk2l0,1151
18
+ airflow/providers/common/compat/security/permissions.py,sha256=lkmW7IyE56sK0xPdc2dg7EeuS_EJBVfERoSD_Ct7lf0,1448
17
19
  airflow/providers/common/compat/standard/__init__.py,sha256=9hdXHABrVpkbpjZgUft39kOFL2xSGeG4GEua0Hmelus,785
18
20
  airflow/providers/common/compat/standard/operators.py,sha256=1jsiu8Cc6S2Xhhfo2Rh5PqJCnQ1CBH_UW5q7s3Y0Mpc,1712
19
21
  airflow/providers/common/compat/standard/triggers.py,sha256=XBi9KE-cAY_TlIyKVqr1-EU7xZNqgCVTugXZObV3gaQ,1177
20
22
  airflow/providers/common/compat/standard/utils.py,sha256=SvTXThqYRKVfmRRpq-D5eNcxQjY9TESrTyl3n670QM8,1289
21
- apache_airflow_providers_common_compat-1.5.1.dist-info/entry_points.txt,sha256=OdOClAuY8E82VvA-Zo6narFujtXdGihHKZH2HfmlPIo,109
22
- apache_airflow_providers_common_compat-1.5.1.dist-info/WHEEL,sha256=_2ozNFCLWc93bK4WKHCO-eDUENDlo-dgc9cU3qokYO4,82
23
- apache_airflow_providers_common_compat-1.5.1.dist-info/METADATA,sha256=1muRXsNxAATmGYr2jHFdryzV0aiO01RHMch0ELNLB9Y,5287
24
- apache_airflow_providers_common_compat-1.5.1.dist-info/RECORD,,
23
+ apache_airflow_providers_common_compat-1.6.0b1.dist-info/entry_points.txt,sha256=OdOClAuY8E82VvA-Zo6narFujtXdGihHKZH2HfmlPIo,109
24
+ apache_airflow_providers_common_compat-1.6.0b1.dist-info/WHEEL,sha256=_2ozNFCLWc93bK4WKHCO-eDUENDlo-dgc9cU3qokYO4,82
25
+ apache_airflow_providers_common_compat-1.6.0b1.dist-info/METADATA,sha256=F5-kvFY2qiIEY4AxB6dq_V_1YAKRFvgZXNfA29MaouA,5303
26
+ apache_airflow_providers_common_compat-1.6.0b1.dist-info/RECORD,,