apache-airflow-providers-sftp 4.9.0rc1__py3-none-any.whl → 4.9.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.
@@ -27,7 +27,7 @@ import packaging.version
27
27
 
28
28
  __all__ = ["__version__"]
29
29
 
30
- __version__ = "4.9.0"
30
+ __version__ = "4.9.1"
31
31
 
32
32
  try:
33
33
  from airflow import __version__ as airflow_version
@@ -28,8 +28,9 @@ def get_provider_info():
28
28
  "name": "SFTP",
29
29
  "description": "`SSH File Transfer Protocol (SFTP) <https://tools.ietf.org/wg/secsh/draft-ietf-secsh-filexfer/>`__\n",
30
30
  "state": "ready",
31
- "source-date-epoch": 1707636511,
31
+ "source-date-epoch": 1712666452,
32
32
  "versions": [
33
+ "4.9.1",
33
34
  "4.9.0",
34
35
  "4.8.1",
35
36
  "4.8.0",
@@ -16,6 +16,7 @@
16
16
  # specific language governing permissions and limitations
17
17
  # under the License.
18
18
  """This module contains SFTP hook."""
19
+
19
20
  from __future__ import annotations
20
21
 
21
22
  import datetime
@@ -515,25 +516,24 @@ class SFTPHookAsync(BaseHook):
515
516
  ssh_client_conn = await asyncssh.connect(**conn_config)
516
517
  return ssh_client_conn
517
518
 
518
- async def list_directory(self, path: str = "") -> list[str] | None:
519
+ async def list_directory(self, path: str = "") -> list[str] | None: # type: ignore[return]
519
520
  """Return a list of files on the SFTP server at the provided path."""
520
- ssh_conn = await self._get_conn()
521
- sftp_client = await ssh_conn.start_sftp_client()
522
- try:
523
- files = await sftp_client.listdir(path)
524
- return sorted(files)
525
- except asyncssh.SFTPNoSuchFile:
526
- return None
527
-
528
- async def read_directory(self, path: str = "") -> Sequence[asyncssh.sftp.SFTPName] | None:
521
+ async with await self._get_conn() as ssh_conn:
522
+ sftp_client = await ssh_conn.start_sftp_client()
523
+ try:
524
+ files = await sftp_client.listdir(path)
525
+ return sorted(files)
526
+ except asyncssh.SFTPNoSuchFile:
527
+ return None
528
+
529
+ async def read_directory(self, path: str = "") -> Sequence[asyncssh.sftp.SFTPName] | None: # type: ignore[return]
529
530
  """Return a list of files along with their attributes on the SFTP server at the provided path."""
530
- ssh_conn = await self._get_conn()
531
- sftp_client = await ssh_conn.start_sftp_client()
532
- try:
533
- files = await sftp_client.readdir(path)
534
- return files
535
- except asyncssh.SFTPNoSuchFile:
536
- return None
531
+ async with await self._get_conn() as ssh_conn:
532
+ sftp_client = await ssh_conn.start_sftp_client()
533
+ try:
534
+ return await sftp_client.readdir(path)
535
+ except asyncssh.SFTPNoSuchFile:
536
+ return None
537
537
 
538
538
  async def get_files_and_attrs_by_pattern(
539
539
  self, path: str = "", fnmatch_pattern: str = ""
@@ -16,6 +16,7 @@
16
16
  # specific language governing permissions and limitations
17
17
  # under the License.
18
18
  """This module contains SFTP operator."""
19
+
19
20
  from __future__ import annotations
20
21
 
21
22
  import os
@@ -210,7 +211,9 @@ class SFTPOperator(BaseOperator):
210
211
  local_host = socket.gethostbyname(local_host)
211
212
  except Exception as e:
212
213
  self.log.warning(
213
- f"Failed to resolve local hostname. Using the hostname got by socket.gethostbyname() without resolution. {e}",
214
+ "Failed to resolve local hostname. "
215
+ "Using the hostname got by socket.gethostbyname() without resolution. %s",
216
+ e,
214
217
  exc_info=True,
215
218
  )
216
219
 
@@ -225,7 +228,8 @@ class SFTPOperator(BaseOperator):
225
228
  remote_host = socket.gethostbyname(remote_host)
226
229
  except OSError as e:
227
230
  self.log.warning(
228
- f"Failed to resolve remote hostname. Using the provided hostname without resolution. {e}",
231
+ "Failed to resolve remote hostname. Using the provided hostname without resolution. %s",
232
+ e,
229
233
  exc_info=True,
230
234
  )
231
235
 
@@ -16,6 +16,7 @@
16
16
  # specific language governing permissions and limitations
17
17
  # under the License.
18
18
  """This module contains SFTP sensor."""
19
+
19
20
  from __future__ import annotations
20
21
 
21
22
  import os
@@ -113,14 +113,17 @@ class SFTPTrigger(BaseTrigger):
113
113
  "message": f"Sensed {len(files_sensed)} files: {files_sensed}",
114
114
  }
115
115
  )
116
+ return
116
117
  else:
117
118
  mod_time = await hook.get_mod_time(self.path)
118
119
  if _newer_than:
119
120
  mod_time_utc = convert_to_utc(datetime.strptime(mod_time, "%Y%m%d%H%M%S"))
120
121
  if _newer_than <= mod_time_utc:
121
122
  yield TriggerEvent({"status": "success", "message": f"Sensed file: {self.path}"})
123
+ return
122
124
  else:
123
125
  yield TriggerEvent({"status": "success", "message": f"Sensed file: {self.path}"})
126
+ return
124
127
  await asyncio.sleep(self.poke_interval)
125
128
  except AirflowException:
126
129
  await asyncio.sleep(self.poke_interval)
@@ -131,7 +134,7 @@ class SFTPTrigger(BaseTrigger):
131
134
  # Break loop to avoid infinite retries on terminal failure
132
135
  break
133
136
 
134
- yield TriggerEvent({"status": "error", "message": exc})
137
+ yield TriggerEvent({"status": "error", "message": str(exc)})
135
138
 
136
139
  def _get_async_hook(self) -> SFTPHookAsync:
137
140
  return SFTPHookAsync(sftp_conn_id=self.sftp_conn_id)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: apache-airflow-providers-sftp
3
- Version: 4.9.0rc1
3
+ Version: 4.9.1
4
4
  Summary: Provider package apache-airflow-providers-sftp for Apache Airflow
5
5
  Keywords: airflow-provider,sftp,airflow,integration
6
6
  Author-email: Apache Software Foundation <dev@airflow.apache.org>
@@ -19,16 +19,17 @@ Classifier: Programming Language :: Python :: 3.8
19
19
  Classifier: Programming Language :: Python :: 3.9
20
20
  Classifier: Programming Language :: Python :: 3.10
21
21
  Classifier: Programming Language :: Python :: 3.11
22
+ Classifier: Programming Language :: Python :: 3.12
22
23
  Classifier: Topic :: System :: Monitoring
23
- Requires-Dist: apache-airflow-providers-ssh>=2.1.0.dev0
24
- Requires-Dist: apache-airflow>=2.6.0.dev0
24
+ Requires-Dist: apache-airflow-providers-ssh>=2.1.0
25
+ Requires-Dist: apache-airflow>=2.6.0
25
26
  Requires-Dist: asyncssh>=2.12.0
26
27
  Requires-Dist: paramiko>=2.8.0
27
28
  Requires-Dist: apache-airflow-providers-openlineage ; extra == "openlineage"
28
29
  Requires-Dist: apache-airflow-providers-ssh ; extra == "ssh"
29
30
  Project-URL: Bug Tracker, https://github.com/apache/airflow/issues
30
- Project-URL: Changelog, https://airflow.apache.org/docs/apache-airflow-providers-sftp/4.9.0/changelog.html
31
- Project-URL: Documentation, https://airflow.apache.org/docs/apache-airflow-providers-sftp/4.9.0
31
+ Project-URL: Changelog, https://airflow.apache.org/docs/apache-airflow-providers-sftp/4.9.1/changelog.html
32
+ Project-URL: Documentation, https://airflow.apache.org/docs/apache-airflow-providers-sftp/4.9.1
32
33
  Project-URL: Slack Chat, https://s.apache.org/airflow-slack
33
34
  Project-URL: Source Code, https://github.com/apache/airflow
34
35
  Project-URL: Twitter, https://twitter.com/ApacheAirflow
@@ -80,7 +81,7 @@ Provides-Extra: ssh
80
81
 
81
82
  Package ``apache-airflow-providers-sftp``
82
83
 
83
- Release: ``4.9.0.rc1``
84
+ Release: ``4.9.1``
84
85
 
85
86
 
86
87
  `SSH File Transfer Protocol (SFTP) <https://tools.ietf.org/wg/secsh/draft-ietf-secsh-filexfer/>`__
@@ -93,7 +94,7 @@ This is a provider package for ``sftp`` provider. All classes for this provider
93
94
  are in ``airflow.providers.sftp`` python package.
94
95
 
95
96
  You can find package information and changelog for the provider
96
- in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-sftp/4.9.0/>`_.
97
+ in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-sftp/4.9.1/>`_.
97
98
 
98
99
  Installation
99
100
  ------------
@@ -102,7 +103,7 @@ You can install this package on top of an existing Airflow 2 installation (see `
102
103
  for the minimum Airflow version supported) via
103
104
  ``pip install apache-airflow-providers-sftp``
104
105
 
105
- The package supports the following python versions: 3.8,3.9,3.10,3.11
106
+ The package supports the following python versions: 3.8,3.9,3.10,3.11,3.12
106
107
 
107
108
  Requirements
108
109
  ------------
@@ -137,4 +138,4 @@ Dependent package
137
138
  ============================================================================================================== ===============
138
139
 
139
140
  The changelog for the provider package can be found in the
140
- `changelog <https://airflow.apache.org/docs/apache-airflow-providers-sftp/4.9.0/changelog.html>`_.
141
+ `changelog <https://airflow.apache.org/docs/apache-airflow-providers-sftp/4.9.1/changelog.html>`_.
@@ -0,0 +1,18 @@
1
+ airflow/providers/sftp/LICENSE,sha256=ywUBpKZc7Jb96rVt5I3IDbg7dIJAbUSHkuoDcF3jbH4,13569
2
+ airflow/providers/sftp/__init__.py,sha256=oAXhh6fGTiw-xiobiAprNUUzB50KuosqEcVI8FtlQzU,1579
3
+ airflow/providers/sftp/get_provider_info.py,sha256=3J_3JgpUr69rSmWNiAE70oF4-9_bbsJRJgCZMc44vbo,3933
4
+ airflow/providers/sftp/decorators/__init__.py,sha256=9hdXHABrVpkbpjZgUft39kOFL2xSGeG4GEua0Hmelus,785
5
+ airflow/providers/sftp/decorators/sensors/__init__.py,sha256=9hdXHABrVpkbpjZgUft39kOFL2xSGeG4GEua0Hmelus,785
6
+ airflow/providers/sftp/decorators/sensors/sftp.py,sha256=sgKMNvThkZt8MtJJH9QUnT3FdJlu18NAiTzRF08PFSY,2861
7
+ airflow/providers/sftp/hooks/__init__.py,sha256=9hdXHABrVpkbpjZgUft39kOFL2xSGeG4GEua0Hmelus,785
8
+ airflow/providers/sftp/hooks/sftp.py,sha256=QVgeshBY0zXZOAEUJKc44E0QXRNArNvNsvPWfaLVjeo,21856
9
+ airflow/providers/sftp/operators/__init__.py,sha256=9hdXHABrVpkbpjZgUft39kOFL2xSGeG4GEua0Hmelus,785
10
+ airflow/providers/sftp/operators/sftp.py,sha256=8HbXEm0tB15Fv_8n445z4-PxgQvLE_n-Dhz7wr6Mw8w,11508
11
+ airflow/providers/sftp/sensors/__init__.py,sha256=9hdXHABrVpkbpjZgUft39kOFL2xSGeG4GEua0Hmelus,785
12
+ airflow/providers/sftp/sensors/sftp.py,sha256=YL3knPWsgGG1PzDoMOIaAUgZeyBkeJQ6I5-Ka5Ww3hY,7382
13
+ airflow/providers/sftp/triggers/__init__.py,sha256=9hdXHABrVpkbpjZgUft39kOFL2xSGeG4GEua0Hmelus,785
14
+ airflow/providers/sftp/triggers/sftp.py,sha256=8CyIeW0h-BFJAcyDqW4YmlSq-Wr4fV-9sA5TquP4fTM,6155
15
+ apache_airflow_providers_sftp-4.9.1.dist-info/entry_points.txt,sha256=Fa1IkUHV6qnIuwLd0U7tKoklbLXXVrbB2hhG6N7Q-zo,100
16
+ apache_airflow_providers_sftp-4.9.1.dist-info/WHEEL,sha256=EZbGkh7Ie4PoZfRQ8I0ZuP9VklN_TvcZ6DSE5Uar4z4,81
17
+ apache_airflow_providers_sftp-4.9.1.dist-info/METADATA,sha256=7uF9xu1M_yXanU3t9qNrWURS-qF9vTg3UzQmXJ9xYeo,6384
18
+ apache_airflow_providers_sftp-4.9.1.dist-info/RECORD,,
@@ -1,18 +0,0 @@
1
- airflow/providers/sftp/LICENSE,sha256=ywUBpKZc7Jb96rVt5I3IDbg7dIJAbUSHkuoDcF3jbH4,13569
2
- airflow/providers/sftp/__init__.py,sha256=NM90bOaFBlVVseUvaUiI_zXtDY2QgKtlSKrkxDcbNks,1579
3
- airflow/providers/sftp/get_provider_info.py,sha256=MYaJoEv6gio7JvcmEaMf8gq3pASlv712V5H-Ag7_al8,3912
4
- airflow/providers/sftp/decorators/__init__.py,sha256=9hdXHABrVpkbpjZgUft39kOFL2xSGeG4GEua0Hmelus,785
5
- airflow/providers/sftp/decorators/sensors/__init__.py,sha256=9hdXHABrVpkbpjZgUft39kOFL2xSGeG4GEua0Hmelus,785
6
- airflow/providers/sftp/decorators/sensors/sftp.py,sha256=sgKMNvThkZt8MtJJH9QUnT3FdJlu18NAiTzRF08PFSY,2861
7
- airflow/providers/sftp/hooks/__init__.py,sha256=9hdXHABrVpkbpjZgUft39kOFL2xSGeG4GEua0Hmelus,785
8
- airflow/providers/sftp/hooks/sftp.py,sha256=zpP6tvEk4DTNSESqGx3BJ6T_WH5V6Kzv9jsuGkLMPo8,21763
9
- airflow/providers/sftp/operators/__init__.py,sha256=9hdXHABrVpkbpjZgUft39kOFL2xSGeG4GEua0Hmelus,785
10
- airflow/providers/sftp/operators/sftp.py,sha256=ZV77xKlUw5yXXhnM3tCOadi4Xc_tGx1yOnJbLVYpuf0,11454
11
- airflow/providers/sftp/sensors/__init__.py,sha256=9hdXHABrVpkbpjZgUft39kOFL2xSGeG4GEua0Hmelus,785
12
- airflow/providers/sftp/sensors/sftp.py,sha256=kz1XqzNfzlnZKVBXRblsEM2KWzv12Pju1gjrycF7Dd8,7381
13
- airflow/providers/sftp/triggers/__init__.py,sha256=9hdXHABrVpkbpjZgUft39kOFL2xSGeG4GEua0Hmelus,785
14
- airflow/providers/sftp/triggers/sftp.py,sha256=DkN23KgW4reDgIsHZkZlsXksbdnODB0XNld4r4VwPUI,6053
15
- apache_airflow_providers_sftp-4.9.0rc1.dist-info/entry_points.txt,sha256=Fa1IkUHV6qnIuwLd0U7tKoklbLXXVrbB2hhG6N7Q-zo,100
16
- apache_airflow_providers_sftp-4.9.0rc1.dist-info/WHEEL,sha256=EZbGkh7Ie4PoZfRQ8I0ZuP9VklN_TvcZ6DSE5Uar4z4,81
17
- apache_airflow_providers_sftp-4.9.0rc1.dist-info/METADATA,sha256=I9pMsEha8yizdDsJuDW1CjQwAZnWuCXDB7m5pabuaNo,6345
18
- apache_airflow_providers_sftp-4.9.0rc1.dist-info/RECORD,,