apache-airflow-providers-sftp 4.4.0__tar.gz → 4.5.0__tar.gz

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.
Files changed (26) hide show
  1. {apache-airflow-providers-sftp-4.4.0/apache_airflow_providers_sftp.egg-info → apache-airflow-providers-sftp-4.5.0}/PKG-INFO +14 -12
  2. {apache-airflow-providers-sftp-4.4.0 → apache-airflow-providers-sftp-4.5.0}/README.rst +10 -9
  3. {apache-airflow-providers-sftp-4.4.0 → apache-airflow-providers-sftp-4.5.0}/airflow/providers/sftp/__init__.py +4 -2
  4. {apache-airflow-providers-sftp-4.4.0 → apache-airflow-providers-sftp-4.5.0}/airflow/providers/sftp/get_provider_info.py +1 -0
  5. {apache-airflow-providers-sftp-4.4.0 → apache-airflow-providers-sftp-4.5.0}/airflow/providers/sftp/operators/sftp.py +82 -0
  6. {apache-airflow-providers-sftp-4.4.0 → apache-airflow-providers-sftp-4.5.0/apache_airflow_providers_sftp.egg-info}/PKG-INFO +14 -12
  7. {apache-airflow-providers-sftp-4.4.0 → apache-airflow-providers-sftp-4.5.0}/apache_airflow_providers_sftp.egg-info/requires.txt +3 -0
  8. {apache-airflow-providers-sftp-4.4.0 → apache-airflow-providers-sftp-4.5.0}/pyproject.toml +5 -28
  9. {apache-airflow-providers-sftp-4.4.0 → apache-airflow-providers-sftp-4.5.0}/setup.cfg +2 -2
  10. {apache-airflow-providers-sftp-4.4.0 → apache-airflow-providers-sftp-4.5.0}/setup.py +5 -2
  11. {apache-airflow-providers-sftp-4.4.0 → apache-airflow-providers-sftp-4.5.0}/LICENSE +0 -0
  12. {apache-airflow-providers-sftp-4.4.0 → apache-airflow-providers-sftp-4.5.0}/MANIFEST.in +0 -0
  13. {apache-airflow-providers-sftp-4.4.0 → apache-airflow-providers-sftp-4.5.0}/NOTICE +0 -0
  14. {apache-airflow-providers-sftp-4.4.0 → apache-airflow-providers-sftp-4.5.0}/airflow/providers/sftp/decorators/__init__.py +0 -0
  15. {apache-airflow-providers-sftp-4.4.0 → apache-airflow-providers-sftp-4.5.0}/airflow/providers/sftp/decorators/sensors/__init__.py +0 -0
  16. {apache-airflow-providers-sftp-4.4.0 → apache-airflow-providers-sftp-4.5.0}/airflow/providers/sftp/decorators/sensors/sftp.py +0 -0
  17. {apache-airflow-providers-sftp-4.4.0 → apache-airflow-providers-sftp-4.5.0}/airflow/providers/sftp/hooks/__init__.py +0 -0
  18. {apache-airflow-providers-sftp-4.4.0 → apache-airflow-providers-sftp-4.5.0}/airflow/providers/sftp/hooks/sftp.py +0 -0
  19. {apache-airflow-providers-sftp-4.4.0 → apache-airflow-providers-sftp-4.5.0}/airflow/providers/sftp/operators/__init__.py +0 -0
  20. {apache-airflow-providers-sftp-4.4.0 → apache-airflow-providers-sftp-4.5.0}/airflow/providers/sftp/sensors/__init__.py +0 -0
  21. {apache-airflow-providers-sftp-4.4.0 → apache-airflow-providers-sftp-4.5.0}/airflow/providers/sftp/sensors/sftp.py +0 -0
  22. {apache-airflow-providers-sftp-4.4.0 → apache-airflow-providers-sftp-4.5.0}/apache_airflow_providers_sftp.egg-info/SOURCES.txt +0 -0
  23. {apache-airflow-providers-sftp-4.4.0 → apache-airflow-providers-sftp-4.5.0}/apache_airflow_providers_sftp.egg-info/dependency_links.txt +0 -0
  24. {apache-airflow-providers-sftp-4.4.0 → apache-airflow-providers-sftp-4.5.0}/apache_airflow_providers_sftp.egg-info/entry_points.txt +0 -0
  25. {apache-airflow-providers-sftp-4.4.0 → apache-airflow-providers-sftp-4.5.0}/apache_airflow_providers_sftp.egg-info/not-zip-safe +0 -0
  26. {apache-airflow-providers-sftp-4.4.0 → apache-airflow-providers-sftp-4.5.0}/apache_airflow_providers_sftp.egg-info/top_level.txt +0 -0
@@ -1,14 +1,14 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: apache-airflow-providers-sftp
3
- Version: 4.4.0
3
+ Version: 4.5.0
4
4
  Summary: Provider for Apache Airflow. Implements apache-airflow-providers-sftp package
5
5
  Home-page: https://airflow.apache.org/
6
6
  Download-URL: https://archive.apache.org/dist/airflow/providers
7
7
  Author: Apache Software Foundation
8
8
  Author-email: dev@airflow.apache.org
9
9
  License: Apache License 2.0
10
- Project-URL: Documentation, https://airflow.apache.org/docs/apache-airflow-providers-sftp/4.4.0/
11
- Project-URL: Changelog, https://airflow.apache.org/docs/apache-airflow-providers-sftp/4.4.0/changelog.html
10
+ Project-URL: Documentation, https://airflow.apache.org/docs/apache-airflow-providers-sftp/4.5.0/
11
+ Project-URL: Changelog, https://airflow.apache.org/docs/apache-airflow-providers-sftp/4.5.0/changelog.html
12
12
  Project-URL: Bug Tracker, https://github.com/apache/airflow/issues
13
13
  Project-URL: Source Code, https://github.com/apache/airflow
14
14
  Project-URL: Slack Chat, https://s.apache.org/airflow-slack
@@ -29,6 +29,7 @@ Classifier: Programming Language :: Python :: 3.11
29
29
  Classifier: Topic :: System :: Monitoring
30
30
  Requires-Python: ~=3.8
31
31
  Description-Content-Type: text/x-rst
32
+ Provides-Extra: openlineage
32
33
  Provides-Extra: ssh
33
34
  License-File: LICENSE
34
35
  License-File: NOTICE
@@ -71,7 +72,7 @@ License-File: NOTICE
71
72
 
72
73
  Package ``apache-airflow-providers-sftp``
73
74
 
74
- Release: ``4.4.0``
75
+ Release: ``4.5.0``
75
76
 
76
77
 
77
78
  `SSH File Transfer Protocol (SFTP) <https://tools.ietf.org/wg/secsh/draft-ietf-secsh-filexfer/>`__
@@ -84,7 +85,7 @@ This is a provider package for ``sftp`` provider. All classes for this provider
84
85
  are in ``airflow.providers.sftp`` python package.
85
86
 
86
87
  You can find package information and changelog for the provider
87
- in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-sftp/4.4.0/>`_.
88
+ in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-sftp/4.5.0/>`_.
88
89
 
89
90
 
90
91
  Installation
@@ -116,14 +117,15 @@ You can install such cross-provider dependencies when installing from PyPI. For
116
117
 
117
118
  .. code-block:: bash
118
119
 
119
- pip install apache-airflow-providers-sftp[ssh]
120
+ pip install apache-airflow-providers-sftp[openlineage]
120
121
 
121
122
 
122
- ============================================================================================== =======
123
- Dependent package Extra
124
- ============================================================================================== =======
125
- `apache-airflow-providers-ssh <https://airflow.apache.org/docs/apache-airflow-providers-ssh>`_ ``ssh``
126
- ============================================================================================== =======
123
+ ============================================================================================================== ===============
124
+ Dependent package Extra
125
+ ============================================================================================================== ===============
126
+ `apache-airflow-providers-openlineage <https://airflow.apache.org/docs/apache-airflow-providers-openlineage>`_ ``openlineage``
127
+ `apache-airflow-providers-ssh <https://airflow.apache.org/docs/apache-airflow-providers-ssh>`_ ``ssh``
128
+ ============================================================================================================== ===============
127
129
 
128
130
  The changelog for the provider package can be found in the
129
- `changelog <https://airflow.apache.org/docs/apache-airflow-providers-sftp/4.4.0/changelog.html>`_.
131
+ `changelog <https://airflow.apache.org/docs/apache-airflow-providers-sftp/4.5.0/changelog.html>`_.
@@ -36,7 +36,7 @@
36
36
 
37
37
  Package ``apache-airflow-providers-sftp``
38
38
 
39
- Release: ``4.4.0``
39
+ Release: ``4.5.0``
40
40
 
41
41
 
42
42
  `SSH File Transfer Protocol (SFTP) <https://tools.ietf.org/wg/secsh/draft-ietf-secsh-filexfer/>`__
@@ -49,7 +49,7 @@ This is a provider package for ``sftp`` provider. All classes for this provider
49
49
  are in ``airflow.providers.sftp`` python package.
50
50
 
51
51
  You can find package information and changelog for the provider
52
- in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-sftp/4.4.0/>`_.
52
+ in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-sftp/4.5.0/>`_.
53
53
 
54
54
 
55
55
  Installation
@@ -81,14 +81,15 @@ You can install such cross-provider dependencies when installing from PyPI. For
81
81
 
82
82
  .. code-block:: bash
83
83
 
84
- pip install apache-airflow-providers-sftp[ssh]
84
+ pip install apache-airflow-providers-sftp[openlineage]
85
85
 
86
86
 
87
- ============================================================================================== =======
88
- Dependent package Extra
89
- ============================================================================================== =======
90
- `apache-airflow-providers-ssh <https://airflow.apache.org/docs/apache-airflow-providers-ssh>`_ ``ssh``
91
- ============================================================================================== =======
87
+ ============================================================================================================== ===============
88
+ Dependent package Extra
89
+ ============================================================================================================== ===============
90
+ `apache-airflow-providers-openlineage <https://airflow.apache.org/docs/apache-airflow-providers-openlineage>`_ ``openlineage``
91
+ `apache-airflow-providers-ssh <https://airflow.apache.org/docs/apache-airflow-providers-ssh>`_ ``ssh``
92
+ ============================================================================================================== ===============
92
93
 
93
94
  The changelog for the provider package can be found in the
94
- `changelog <https://airflow.apache.org/docs/apache-airflow-providers-sftp/4.4.0/changelog.html>`_.
95
+ `changelog <https://airflow.apache.org/docs/apache-airflow-providers-sftp/4.5.0/changelog.html>`_.
@@ -28,14 +28,16 @@ import packaging.version
28
28
 
29
29
  __all__ = ["__version__"]
30
30
 
31
- __version__ = "4.4.0"
31
+ __version__ = "4.5.0"
32
32
 
33
33
  try:
34
34
  from airflow import __version__ as airflow_version
35
35
  except ImportError:
36
36
  from airflow.version import version as airflow_version
37
37
 
38
- if packaging.version.parse(airflow_version) < packaging.version.parse("2.4.0"):
38
+ if packaging.version.parse(packaging.version.parse(airflow_version).base_version) < packaging.version.parse(
39
+ "2.4.0"
40
+ ):
39
41
  raise RuntimeError(
40
42
  f"The package `apache-airflow-providers-sftp:{__version__}` requires Apache Airflow 2.4.0+" # NOQA: E501
41
43
  )
@@ -29,6 +29,7 @@ def get_provider_info():
29
29
  "description": "`SSH File Transfer Protocol (SFTP) <https://tools.ietf.org/wg/secsh/draft-ietf-secsh-filexfer/>`__\n",
30
30
  "suspended": False,
31
31
  "versions": [
32
+ "4.5.0",
32
33
  "4.4.0",
33
34
  "4.3.1",
34
35
  "4.3.0",
@@ -19,10 +19,13 @@
19
19
  from __future__ import annotations
20
20
 
21
21
  import os
22
+ import socket
22
23
  import warnings
23
24
  from pathlib import Path
24
25
  from typing import Any, Sequence
25
26
 
27
+ import paramiko
28
+
26
29
  from airflow.exceptions import AirflowException, AirflowProviderDeprecationWarning
27
30
  from airflow.models import BaseOperator
28
31
  from airflow.providers.sftp.hooks.sftp import SFTPHook
@@ -188,3 +191,82 @@ class SFTPOperator(BaseOperator):
188
191
  raise AirflowException(f"Error while transferring {file_msg}, error: {str(e)}")
189
192
 
190
193
  return self.local_filepath
194
+
195
+ def get_openlineage_facets_on_start(self):
196
+ """
197
+ This returns OpenLineage datasets in format:
198
+ input: file://<local_host>/path
199
+ output: file://<remote_host>:<remote_port>/path.
200
+ """
201
+ from openlineage.client.run import Dataset
202
+
203
+ from airflow.providers.openlineage.extractors import OperatorLineage
204
+
205
+ scheme = "file"
206
+ local_host = socket.gethostname()
207
+ try:
208
+ local_host = socket.gethostbyname(local_host)
209
+ except Exception as e:
210
+ self.log.warning(
211
+ f"Failed to resolve local hostname. Using the hostname got by socket.gethostbyname() without resolution. {e}", # noqa: E501
212
+ exc_info=True,
213
+ )
214
+
215
+ hook = self.sftp_hook or self.ssh_hook or SFTPHook(ssh_conn_id=self.ssh_conn_id)
216
+
217
+ if self.remote_host is not None:
218
+ remote_host = self.remote_host
219
+ else:
220
+ remote_host = hook.get_connection(hook.ssh_conn_id).host
221
+
222
+ try:
223
+ remote_host = socket.gethostbyname(remote_host)
224
+ except OSError as e:
225
+ self.log.warning(
226
+ f"Failed to resolve remote hostname. Using the provided hostname without resolution. {e}", # noqa: E501
227
+ exc_info=True,
228
+ )
229
+
230
+ if hasattr(hook, "port"):
231
+ remote_port = hook.port
232
+ elif hasattr(hook, "ssh_hook"):
233
+ remote_port = hook.ssh_hook.port
234
+
235
+ # Since v4.1.0, SFTPOperator accepts both a string (single file) and a list of
236
+ # strings (multiple files) as local_filepath and remote_filepath, and internally
237
+ # keeps them as list in both cases. But before 4.1.0, only single string is
238
+ # allowed. So we consider both cases here for backward compatibility.
239
+ if isinstance(self.local_filepath, str):
240
+ local_filepath = [self.local_filepath]
241
+ else:
242
+ local_filepath = self.local_filepath
243
+ if isinstance(self.remote_filepath, str):
244
+ remote_filepath = [self.remote_filepath]
245
+ else:
246
+ remote_filepath = self.remote_filepath
247
+
248
+ local_datasets = [
249
+ Dataset(namespace=self._get_namespace(scheme, local_host, None, path), name=path)
250
+ for path in local_filepath
251
+ ]
252
+ remote_datasets = [
253
+ Dataset(namespace=self._get_namespace(scheme, remote_host, remote_port, path), name=path)
254
+ for path in remote_filepath
255
+ ]
256
+
257
+ if self.operation.lower() == SFTPOperation.GET:
258
+ inputs = remote_datasets
259
+ outputs = local_datasets
260
+ else:
261
+ inputs = local_datasets
262
+ outputs = remote_datasets
263
+
264
+ return OperatorLineage(
265
+ inputs=inputs,
266
+ outputs=outputs,
267
+ )
268
+
269
+ def _get_namespace(self, scheme, host, port, path) -> str:
270
+ port = port or paramiko.config.SSH_PORT
271
+ authority = f"{host}:{port}"
272
+ return f"{scheme}://{authority}"
@@ -1,14 +1,14 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: apache-airflow-providers-sftp
3
- Version: 4.4.0
3
+ Version: 4.5.0
4
4
  Summary: Provider for Apache Airflow. Implements apache-airflow-providers-sftp package
5
5
  Home-page: https://airflow.apache.org/
6
6
  Download-URL: https://archive.apache.org/dist/airflow/providers
7
7
  Author: Apache Software Foundation
8
8
  Author-email: dev@airflow.apache.org
9
9
  License: Apache License 2.0
10
- Project-URL: Documentation, https://airflow.apache.org/docs/apache-airflow-providers-sftp/4.4.0/
11
- Project-URL: Changelog, https://airflow.apache.org/docs/apache-airflow-providers-sftp/4.4.0/changelog.html
10
+ Project-URL: Documentation, https://airflow.apache.org/docs/apache-airflow-providers-sftp/4.5.0/
11
+ Project-URL: Changelog, https://airflow.apache.org/docs/apache-airflow-providers-sftp/4.5.0/changelog.html
12
12
  Project-URL: Bug Tracker, https://github.com/apache/airflow/issues
13
13
  Project-URL: Source Code, https://github.com/apache/airflow
14
14
  Project-URL: Slack Chat, https://s.apache.org/airflow-slack
@@ -29,6 +29,7 @@ Classifier: Programming Language :: Python :: 3.11
29
29
  Classifier: Topic :: System :: Monitoring
30
30
  Requires-Python: ~=3.8
31
31
  Description-Content-Type: text/x-rst
32
+ Provides-Extra: openlineage
32
33
  Provides-Extra: ssh
33
34
  License-File: LICENSE
34
35
  License-File: NOTICE
@@ -71,7 +72,7 @@ License-File: NOTICE
71
72
 
72
73
  Package ``apache-airflow-providers-sftp``
73
74
 
74
- Release: ``4.4.0``
75
+ Release: ``4.5.0``
75
76
 
76
77
 
77
78
  `SSH File Transfer Protocol (SFTP) <https://tools.ietf.org/wg/secsh/draft-ietf-secsh-filexfer/>`__
@@ -84,7 +85,7 @@ This is a provider package for ``sftp`` provider. All classes for this provider
84
85
  are in ``airflow.providers.sftp`` python package.
85
86
 
86
87
  You can find package information and changelog for the provider
87
- in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-sftp/4.4.0/>`_.
88
+ in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-sftp/4.5.0/>`_.
88
89
 
89
90
 
90
91
  Installation
@@ -116,14 +117,15 @@ You can install such cross-provider dependencies when installing from PyPI. For
116
117
 
117
118
  .. code-block:: bash
118
119
 
119
- pip install apache-airflow-providers-sftp[ssh]
120
+ pip install apache-airflow-providers-sftp[openlineage]
120
121
 
121
122
 
122
- ============================================================================================== =======
123
- Dependent package Extra
124
- ============================================================================================== =======
125
- `apache-airflow-providers-ssh <https://airflow.apache.org/docs/apache-airflow-providers-ssh>`_ ``ssh``
126
- ============================================================================================== =======
123
+ ============================================================================================================== ===============
124
+ Dependent package Extra
125
+ ============================================================================================================== ===============
126
+ `apache-airflow-providers-openlineage <https://airflow.apache.org/docs/apache-airflow-providers-openlineage>`_ ``openlineage``
127
+ `apache-airflow-providers-ssh <https://airflow.apache.org/docs/apache-airflow-providers-ssh>`_ ``ssh``
128
+ ============================================================================================================== ===============
127
129
 
128
130
  The changelog for the provider package can be found in the
129
- `changelog <https://airflow.apache.org/docs/apache-airflow-providers-sftp/4.4.0/changelog.html>`_.
131
+ `changelog <https://airflow.apache.org/docs/apache-airflow-providers-sftp/4.5.0/changelog.html>`_.
@@ -1,5 +1,8 @@
1
1
  apache-airflow-providers-ssh>=2.1.0
2
2
  apache-airflow>=2.4.0
3
3
 
4
+ [openlineage]
5
+ apache-airflow-providers-openlineage
6
+
4
7
  [ssh]
5
8
  apache-airflow-providers-ssh
@@ -41,7 +41,8 @@ extend-exclude = [
41
41
  # The files generated by stubgen aren't 100% valid syntax it turns out, and we don't ship them, so we can
42
42
  # ignore them in ruff
43
43
  "airflow/providers/common/sql/*/*.pyi",
44
- "airflow/migrations/versions/*.py"
44
+ "airflow/migrations/versions/*.py",
45
+ "tests/dags/test_imports.py",
45
46
  ]
46
47
 
47
48
  extend-select = [
@@ -73,6 +74,8 @@ extend-ignore = [
73
74
  "E731",
74
75
  ]
75
76
 
77
+ namespace-packages = ["airflow/providers"]
78
+
76
79
  [tool.pytest.ini_options]
77
80
  # * Disable `flaky` plugin for pytest. This plugin conflicts with `rerunfailures` because provide same marker.
78
81
  # * Disable `nose` builtin plugin for pytest. This feature deprecated in 7.2 and will be removed in pytest>=8
@@ -99,46 +102,20 @@ filterwarnings = [
99
102
  "ignore::DeprecationWarning:apispec.utils",
100
103
  ]
101
104
  python_files = [
102
- "*.py",
105
+ "test_*.py",
103
106
  ]
104
107
  testpaths = [
105
108
  "tests",
106
109
  ]
107
110
 
108
111
  [tool.ruff.isort]
109
- known-first-party = ["airflow", "airflow_breeze", "docker_tests", "docs", "kubernetes_tests", "tests"]
110
112
  required-imports = ["from __future__ import annotations"]
111
113
  combine-as-imports = true
112
114
 
113
- # TODO: for now, https://github.com/charliermarsh/ruff/issues/1817
114
- known-third-party = [
115
- "asana",
116
- "atlassian",
117
- "celery",
118
- "cloudant",
119
- "databricks",
120
- "datadog",
121
- "docker",
122
- "elasticsearch",
123
- "github",
124
- "google",
125
- "grpc",
126
- "jenkins",
127
- "mysql",
128
- "neo4j",
129
- "papermill",
130
- "redis",
131
- "sendgrid",
132
- "snowflake",
133
- "telegram",
134
- "trino",
135
- ]
136
-
137
115
  [tool.ruff.per-file-ignores]
138
116
  "airflow/models/__init__.py" = ["F401"]
139
117
  "airflow/models/sqla_models.py" = ["F401"]
140
118
 
141
-
142
119
  # The test_python.py is needed because adding __future__.annotations breaks runtime checks that are
143
120
  # needed for the test to work
144
121
  "tests/decorators/test_python.py" = ["I002"]
@@ -27,8 +27,8 @@ classifiers =
27
27
  Programming Language :: Python :: 3.11
28
28
  Topic :: System :: Monitoring
29
29
  project_urls =
30
- Documentation=https://airflow.apache.org/docs/apache-airflow-providers-sftp/4.4.0/
31
- Changelog=https://airflow.apache.org/docs/apache-airflow-providers-sftp/4.4.0/changelog.html
30
+ Documentation=https://airflow.apache.org/docs/apache-airflow-providers-sftp/4.5.0/
31
+ Changelog=https://airflow.apache.org/docs/apache-airflow-providers-sftp/4.5.0/changelog.html
32
32
  Bug Tracker=https://github.com/apache/airflow/issues
33
33
  Source Code=https://github.com/apache/airflow
34
34
  Slack Chat=https://s.apache.org/airflow-slack
@@ -26,14 +26,17 @@
26
26
 
27
27
  from setuptools import find_namespace_packages, setup
28
28
 
29
- version = "4.4.0"
29
+ version = "4.5.0"
30
30
 
31
31
 
32
32
  def do_setup():
33
33
  """Perform the package apache-airflow-providers-sftp setup."""
34
34
  setup(
35
35
  version=version,
36
- extras_require={"ssh": ["apache-airflow-providers-ssh"]},
36
+ extras_require={
37
+ "openlineage": ["apache-airflow-providers-openlineage"],
38
+ "ssh": ["apache-airflow-providers-ssh"],
39
+ },
37
40
  packages=find_namespace_packages(
38
41
  include=[
39
42
  "airflow.providers.sftp",