apache-airflow-providers-common-compat 1.2.0rc1__py3-none-any.whl → 1.2.1__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.
@@ -29,7 +29,7 @@ from airflow import __version__ as airflow_version
29
29
 
30
30
  __all__ = ["__version__"]
31
31
 
32
- __version__ = "1.2.0"
32
+ __version__ = "1.2.1"
33
33
 
34
34
  if packaging.version.parse(packaging.version.parse(airflow_version).base_version) < packaging.version.parse(
35
35
  "2.8.0"
@@ -0,0 +1,77 @@
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
+ from typing import TYPE_CHECKING
21
+
22
+ from airflow import __version__ as AIRFLOW_VERSION
23
+
24
+ if TYPE_CHECKING:
25
+ from airflow.assets import (
26
+ Asset,
27
+ AssetAlias,
28
+ AssetAliasEvent,
29
+ AssetAll,
30
+ AssetAny,
31
+ expand_alias_to_assets,
32
+ )
33
+ from airflow.auth.managers.models.resource_details import AssetDetails
34
+ else:
35
+ try:
36
+ from airflow.assets import (
37
+ Asset,
38
+ AssetAlias,
39
+ AssetAliasEvent,
40
+ AssetAll,
41
+ AssetAny,
42
+ expand_alias_to_assets,
43
+ )
44
+ from airflow.auth.managers.models.resource_details import AssetDetails
45
+ except ModuleNotFoundError:
46
+ from packaging.version import Version
47
+
48
+ _IS_AIRFLOW_2_10_OR_HIGHER = Version(Version(AIRFLOW_VERSION).base_version) >= Version("2.10.0")
49
+ _IS_AIRFLOW_2_9_OR_HIGHER = Version(Version(AIRFLOW_VERSION).base_version) >= Version("2.9.0")
50
+
51
+ # dataset is renamed to asset since Airflow 3.0
52
+ from airflow.auth.managers.models.resource_details import DatasetDetails as AssetDetails
53
+ from airflow.datasets import Dataset as Asset
54
+
55
+ if _IS_AIRFLOW_2_9_OR_HIGHER:
56
+ from airflow.datasets import (
57
+ DatasetAll as AssetAll,
58
+ DatasetAny as AssetAny,
59
+ )
60
+
61
+ if _IS_AIRFLOW_2_10_OR_HIGHER:
62
+ from airflow.datasets import (
63
+ DatasetAlias as AssetAlias,
64
+ DatasetAliasEvent as AssetAliasEvent,
65
+ expand_alias_to_datasets as expand_alias_to_assets,
66
+ )
67
+
68
+
69
+ __all__ = [
70
+ "Asset",
71
+ "AssetAlias",
72
+ "AssetAliasEvent",
73
+ "AssetAll",
74
+ "AssetAny",
75
+ "AssetDetails",
76
+ "expand_alias_to_assets",
77
+ ]
@@ -28,8 +28,8 @@ def get_provider_info():
28
28
  "name": "Common Compat",
29
29
  "description": "``Common Compatibility Provider - providing compatibility code for previous Airflow versions.``\n",
30
30
  "state": "ready",
31
- "source-date-epoch": 1723970013,
32
- "versions": ["1.2.0", "1.1.0", "1.0.0"],
31
+ "source-date-epoch": 1728484960,
32
+ "versions": ["1.2.1", "1.2.0", "1.1.0", "1.0.0"],
33
33
  "dependencies": ["apache-airflow>=2.8.0"],
34
34
  "integrations": [
35
35
  {
@@ -16,13 +16,78 @@
16
16
  # under the License.
17
17
  from __future__ import annotations
18
18
 
19
+ from importlib.util import find_spec
20
+
21
+
22
+ def _get_asset_compat_hook_lineage_collector():
23
+ from airflow.lineage.hook import get_hook_lineage_collector
24
+
25
+ collector = get_hook_lineage_collector()
26
+
27
+ if all(
28
+ getattr(collector, asset_method_name, None)
29
+ for asset_method_name in ("add_input_asset", "add_output_asset", "collected_assets")
30
+ ):
31
+ return collector
32
+
33
+ # dataset is renamed as asset in Airflow 3.0
34
+
35
+ from functools import wraps
36
+
37
+ from airflow.lineage.hook import DatasetLineageInfo, HookLineage
38
+
39
+ DatasetLineageInfo.asset = DatasetLineageInfo.dataset
40
+
41
+ def rename_dataset_kwargs_as_assets_kwargs(function):
42
+ @wraps(function)
43
+ def wrapper(*args, **kwargs):
44
+ if "asset_kwargs" in kwargs:
45
+ kwargs["dataset_kwargs"] = kwargs.pop("asset_kwargs")
46
+
47
+ if "asset_extra" in kwargs:
48
+ kwargs["dataset_extra"] = kwargs.pop("asset_extra")
49
+
50
+ return function(*args, **kwargs)
51
+
52
+ return wrapper
53
+
54
+ collector.create_asset = rename_dataset_kwargs_as_assets_kwargs(collector.create_dataset)
55
+ collector.add_input_asset = rename_dataset_kwargs_as_assets_kwargs(collector.add_input_dataset)
56
+ collector.add_output_asset = rename_dataset_kwargs_as_assets_kwargs(collector.add_output_dataset)
57
+
58
+ def collected_assets_compat(collector) -> HookLineage:
59
+ """Get the collected hook lineage information."""
60
+ lineage = collector.collected_datasets
61
+ return HookLineage(
62
+ [
63
+ DatasetLineageInfo(dataset=item.dataset, count=item.count, context=item.context)
64
+ for item in lineage.inputs
65
+ ],
66
+ [
67
+ DatasetLineageInfo(dataset=item.dataset, count=item.count, context=item.context)
68
+ for item in lineage.outputs
69
+ ],
70
+ )
71
+
72
+ setattr(
73
+ collector.__class__,
74
+ "collected_assets",
75
+ property(lambda collector: collected_assets_compat(collector)),
76
+ )
77
+
78
+ return collector
79
+
19
80
 
20
81
  def get_hook_lineage_collector():
21
82
  # HookLineageCollector added in 2.10
22
83
  try:
23
- from airflow.lineage.hook import get_hook_lineage_collector
84
+ if find_spec("airflow.assets"):
85
+ # Dataset has been renamed as Asset in 3.0
86
+ from airflow.lineage.hook import get_hook_lineage_collector
87
+
88
+ return get_hook_lineage_collector()
24
89
 
25
- return get_hook_lineage_collector()
90
+ return _get_asset_compat_hook_lineage_collector()
26
91
  except ImportError:
27
92
 
28
93
  class NoOpCollector:
@@ -32,10 +97,10 @@ def get_hook_lineage_collector():
32
97
  It is used when you want to disable lineage collection.
33
98
  """
34
99
 
35
- def add_input_dataset(self, *_, **__):
100
+ def add_input_asset(self, *_, **__):
36
101
  pass
37
102
 
38
- def add_output_dataset(self, *_, **__):
103
+ def add_output_asset(self, *_, **__):
39
104
  pass
40
105
 
41
106
  return NoOpCollector()
@@ -0,0 +1,16 @@
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.
@@ -0,0 +1,43 @@
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
+ from functools import wraps
21
+ from typing import TYPE_CHECKING
22
+
23
+ if TYPE_CHECKING:
24
+ from airflow.providers.openlineage.utils.utils import translate_airflow_asset
25
+ else:
26
+ try:
27
+ from airflow.providers.openlineage.utils.utils import translate_airflow_asset
28
+ except ImportError:
29
+ from airflow.providers.openlineage.utils.utils import translate_airflow_dataset
30
+
31
+ def rename_asset_as_dataset(function):
32
+ @wraps(function)
33
+ def wrapper(*args, **kwargs):
34
+ if "asset" in kwargs:
35
+ kwargs["dataset"] = kwargs.pop("asset")
36
+ return function(*args, **kwargs)
37
+
38
+ return wrapper
39
+
40
+ translate_airflow_asset = rename_asset_as_dataset(translate_airflow_dataset)
41
+
42
+
43
+ __all__ = ["translate_airflow_asset"]
@@ -0,0 +1,16 @@
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.
@@ -0,0 +1,30 @@
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
+ from __future__ import annotations
18
+
19
+ from typing import TYPE_CHECKING
20
+
21
+ if TYPE_CHECKING:
22
+ from airflow.security.permissions import RESOURCE_ASSET
23
+ else:
24
+ try:
25
+ from airflow.security.permissions import RESOURCE_ASSET
26
+ except ImportError:
27
+ from airflow.security.permissions import RESOURCE_DATASET as RESOURCE_ASSET
28
+
29
+
30
+ __all__ = ["RESOURCE_ASSET"]
@@ -1,11 +1,11 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: apache-airflow-providers-common-compat
3
- Version: 1.2.0rc1
3
+ Version: 1.2.1
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>
7
7
  Maintainer-email: Apache Software Foundation <dev@airflow.apache.org>
8
- Requires-Python: ~=3.8
8
+ Requires-Python: ~=3.9
9
9
  Description-Content-Type: text/x-rst
10
10
  Classifier: Development Status :: 5 - Production/Stable
11
11
  Classifier: Environment :: Console
@@ -15,20 +15,21 @@ Classifier: Intended Audience :: System Administrators
15
15
  Classifier: Framework :: Apache Airflow
16
16
  Classifier: Framework :: Apache Airflow :: Provider
17
17
  Classifier: License :: OSI Approved :: Apache Software License
18
- Classifier: Programming Language :: Python :: 3.8
19
18
  Classifier: Programming Language :: Python :: 3.9
20
19
  Classifier: Programming Language :: Python :: 3.10
21
20
  Classifier: Programming Language :: Python :: 3.11
22
21
  Classifier: Programming Language :: Python :: 3.12
23
22
  Classifier: Topic :: System :: Monitoring
24
- Requires-Dist: apache-airflow>=2.8.0rc0
23
+ Requires-Dist: apache-airflow>=2.8.0
24
+ Requires-Dist: apache-airflow-providers-openlineage ; extra == "openlineage"
25
25
  Project-URL: Bug Tracker, https://github.com/apache/airflow/issues
26
- Project-URL: Changelog, https://airflow.apache.org/docs/apache-airflow-providers-common-compat/1.2.0/changelog.html
27
- Project-URL: Documentation, https://airflow.apache.org/docs/apache-airflow-providers-common-compat/1.2.0
26
+ Project-URL: Changelog, https://airflow.apache.org/docs/apache-airflow-providers-common-compat/1.2.1/changelog.html
27
+ Project-URL: Documentation, https://airflow.apache.org/docs/apache-airflow-providers-common-compat/1.2.1
28
28
  Project-URL: Slack Chat, https://s.apache.org/airflow-slack
29
29
  Project-URL: Source Code, https://github.com/apache/airflow
30
30
  Project-URL: Twitter, https://twitter.com/ApacheAirflow
31
31
  Project-URL: YouTube, https://www.youtube.com/channel/UCSXwxpWZQ7XZ1WL3wqevChA/
32
+ Provides-Extra: openlineage
32
33
 
33
34
 
34
35
  .. Licensed to the Apache Software Foundation (ASF) under one
@@ -74,7 +75,7 @@ Project-URL: YouTube, https://www.youtube.com/channel/UCSXwxpWZQ7XZ1WL3wqevChA/
74
75
 
75
76
  Package ``apache-airflow-providers-common-compat``
76
77
 
77
- Release: ``1.2.0.rc1``
78
+ Release: ``1.2.1``
78
79
 
79
80
 
80
81
  ``Common Compatibility Provider - providing compatibility code for previous Airflow versions.``
@@ -87,7 +88,7 @@ This is a provider package for ``common.compat`` provider. All classes for this
87
88
  are in ``airflow.providers.common.compat`` python package.
88
89
 
89
90
  You can find package information and changelog for the provider
90
- in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-common-compat/1.2.0/>`_.
91
+ in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-common-compat/1.2.1/>`_.
91
92
 
92
93
  Installation
93
94
  ------------
@@ -96,7 +97,7 @@ You can install this package on top of an existing Airflow 2 installation (see `
96
97
  for the minimum Airflow version supported) via
97
98
  ``pip install apache-airflow-providers-common-compat``
98
99
 
99
- The package supports the following python versions: 3.8,3.9,3.10,3.11,3.12
100
+ The package supports the following python versions: 3.9,3.10,3.11,3.12
100
101
 
101
102
  Requirements
102
103
  ------------
@@ -107,5 +108,24 @@ PIP package Version required
107
108
  ``apache-airflow`` ``>=2.8.0``
108
109
  ================== ==================
109
110
 
111
+ Cross provider package dependencies
112
+ -----------------------------------
113
+
114
+ Those are dependencies that might be needed in order to use all the features of the package.
115
+ You need to install the specified provider packages in order to use them.
116
+
117
+ You can install such cross-provider dependencies when installing from PyPI. For example:
118
+
119
+ .. code-block:: bash
120
+
121
+ pip install apache-airflow-providers-common-compat[openlineage]
122
+
123
+
124
+ ============================================================================================================== ===============
125
+ Dependent package Extra
126
+ ============================================================================================================== ===============
127
+ `apache-airflow-providers-openlineage <https://airflow.apache.org/docs/apache-airflow-providers-openlineage>`_ ``openlineage``
128
+ ============================================================================================================== ===============
129
+
110
130
  The changelog for the provider package can be found in the
111
- `changelog <https://airflow.apache.org/docs/apache-airflow-providers-common-compat/1.2.0/changelog.html>`_.
131
+ `changelog <https://airflow.apache.org/docs/apache-airflow-providers-common-compat/1.2.1/changelog.html>`_.
@@ -0,0 +1,16 @@
1
+ airflow/providers/common/compat/LICENSE,sha256=FFb4jd2AXnOOf7XLP04pQW6jbdhG49TxlGY6fFpCV1Y,13609
2
+ airflow/providers/common/compat/__init__.py,sha256=_Xqq8_e-7m_ZXGS9iDXxr7bPQyexl8RHfd0y3zNAzU4,1500
3
+ airflow/providers/common/compat/get_provider_info.py,sha256=xTTwRylldzrHOBDPopEZzegKqmv0_TDk9MBbkdAVPbY,1762
4
+ airflow/providers/common/compat/assets/__init__.py,sha256=6j5EV_cuuK416pZMeMN0q-8dsNWidQkbK2Boltpv6Zc,2547
5
+ airflow/providers/common/compat/lineage/__init__.py,sha256=9hdXHABrVpkbpjZgUft39kOFL2xSGeG4GEua0Hmelus,785
6
+ airflow/providers/common/compat/lineage/hook.py,sha256=7W1T15iz-h5cf0wpW-oMroeIF882PGwqJck3elRJOIs,3606
7
+ airflow/providers/common/compat/openlineage/__init__.py,sha256=9hdXHABrVpkbpjZgUft39kOFL2xSGeG4GEua0Hmelus,785
8
+ airflow/providers/common/compat/openlineage/facet.py,sha256=_3YHsRP39vx6FPePFQCLjNHP9kzisNH5v97o-PWzwLk,6529
9
+ airflow/providers/common/compat/openlineage/utils/__init__.py,sha256=9hdXHABrVpkbpjZgUft39kOFL2xSGeG4GEua0Hmelus,785
10
+ airflow/providers/common/compat/openlineage/utils/utils.py,sha256=KB_1emJIEeYxPG7YscYHmIEDIx9VNmUPtDFz81UuhQk,1617
11
+ airflow/providers/common/compat/security/__init__.py,sha256=9hdXHABrVpkbpjZgUft39kOFL2xSGeG4GEua0Hmelus,785
12
+ airflow/providers/common/compat/security/permissions.py,sha256=krHlEyXJHFOan1lhiRIuEUpEdS2qhOkwkJyvjWEk2l0,1151
13
+ apache_airflow_providers_common_compat-1.2.1.dist-info/entry_points.txt,sha256=OdOClAuY8E82VvA-Zo6narFujtXdGihHKZH2HfmlPIo,109
14
+ apache_airflow_providers_common_compat-1.2.1.dist-info/WHEEL,sha256=EZbGkh7Ie4PoZfRQ8I0ZuP9VklN_TvcZ6DSE5Uar4z4,81
15
+ apache_airflow_providers_common_compat-1.2.1.dist-info/METADATA,sha256=J1BZtCBAussPwaIcboKFvCjWxGu-77P-KlUkB_RVqgU,5911
16
+ apache_airflow_providers_common_compat-1.2.1.dist-info/RECORD,,
@@ -1,11 +0,0 @@
1
- airflow/providers/common/compat/LICENSE,sha256=FFb4jd2AXnOOf7XLP04pQW6jbdhG49TxlGY6fFpCV1Y,13609
2
- airflow/providers/common/compat/__init__.py,sha256=p08a4EORBzu6UP7tnxTCafQN8viXN0M-63kouSRh_40,1500
3
- airflow/providers/common/compat/get_provider_info.py,sha256=LtxctlpQNE0eCrwp_wU0Ib-YAiGmTDLSMaoF94TLjpo,1753
4
- airflow/providers/common/compat/lineage/__init__.py,sha256=9hdXHABrVpkbpjZgUft39kOFL2xSGeG4GEua0Hmelus,785
5
- airflow/providers/common/compat/lineage/hook.py,sha256=AGC4aYxa0WazCOcn64Q5xcRq9HPbeEzpkKtqoB5mi0w,1426
6
- airflow/providers/common/compat/openlineage/__init__.py,sha256=9hdXHABrVpkbpjZgUft39kOFL2xSGeG4GEua0Hmelus,785
7
- airflow/providers/common/compat/openlineage/facet.py,sha256=_3YHsRP39vx6FPePFQCLjNHP9kzisNH5v97o-PWzwLk,6529
8
- apache_airflow_providers_common_compat-1.2.0rc1.dist-info/entry_points.txt,sha256=OdOClAuY8E82VvA-Zo6narFujtXdGihHKZH2HfmlPIo,109
9
- apache_airflow_providers_common_compat-1.2.0rc1.dist-info/WHEEL,sha256=EZbGkh7Ie4PoZfRQ8I0ZuP9VklN_TvcZ6DSE5Uar4z4,81
10
- apache_airflow_providers_common_compat-1.2.0rc1.dist-info/METADATA,sha256=VfHyI51Rl1furdmo2gaqAzjtJoaeEETGq9x-pY0Gd0o,4816
11
- apache_airflow_providers_common_compat-1.2.0rc1.dist-info/RECORD,,