apache-airflow-providers-sftp 5.3.2rc1__py3-none-any.whl → 5.3.3__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__ = "5.3.2"
32
+ __version__ = "5.3.3"
33
33
 
34
34
  if packaging.version.parse(packaging.version.parse(airflow_version).base_version) < packaging.version.parse(
35
35
  "2.10.0"
@@ -29,19 +29,15 @@ from contextlib import contextmanager
29
29
  from fnmatch import fnmatch
30
30
  from io import BytesIO
31
31
  from pathlib import Path
32
- from typing import TYPE_CHECKING, Any
32
+ from typing import IO, TYPE_CHECKING, Any, cast
33
33
 
34
34
  import asyncssh
35
35
  from asgiref.sync import sync_to_async
36
36
 
37
37
  from airflow.exceptions import AirflowException, AirflowProviderDeprecationWarning
38
+ from airflow.providers.sftp.version_compat import BaseHook
38
39
  from airflow.providers.ssh.hooks.ssh import SSHHook
39
40
 
40
- try:
41
- from airflow.sdk import BaseHook
42
- except ImportError:
43
- from airflow.hooks.base import BaseHook # type: ignore[attr-defined,no-redef]
44
-
45
41
  if TYPE_CHECKING:
46
42
  from paramiko import SSHClient
47
43
  from paramiko.sftp_attr import SFTPAttributes
@@ -293,9 +289,25 @@ class SFTPHook(SSHHook):
293
289
  """
294
290
  with self.get_managed_conn() as conn:
295
291
  if isinstance(local_full_path, BytesIO):
292
+ # It's a file-like object ( BytesIO), so use getfo().
293
+ self.log.info("Using streaming download for %s", remote_full_path)
296
294
  conn.getfo(remote_full_path, local_full_path, prefetch=prefetch)
297
- else:
295
+ # We use hasattr checking for 'write' for cases like google.cloud.storage.fileio.BlobWriter
296
+ elif hasattr(local_full_path, "write"):
297
+ self.log.info("Using streaming download for %s", remote_full_path)
298
+ # We need to cast to pass pre-commit checks
299
+ stream_full_path = cast("IO[bytes]", local_full_path)
300
+ conn.getfo(remote_full_path, stream_full_path, prefetch=prefetch)
301
+ elif isinstance(local_full_path, (str, bytes, os.PathLike)):
302
+ # It's a string path, so use get().
303
+ self.log.info("Using standard file download for %s", remote_full_path)
298
304
  conn.get(remote_full_path, local_full_path, prefetch=prefetch)
305
+ # If it's neither, it's an unsupported type.
306
+ else:
307
+ raise TypeError(
308
+ f"Unsupported type for local_full_path: {type(local_full_path)}. "
309
+ "Expected a stream-like object or a path-like object."
310
+ )
299
311
 
300
312
  def store_file(self, remote_full_path: str, local_full_path: str, confirm: bool = True) -> None:
301
313
  """
@@ -743,7 +755,7 @@ class SFTPHookAsync(BaseHook):
743
755
  if self.known_hosts.lower() == "none":
744
756
  conn_config.update(known_hosts=None)
745
757
  else:
746
- conn_config.update(known_hosts=self.known_hosts) # type: ignore
758
+ conn_config.update(known_hosts=self.known_hosts)
747
759
  if self.private_key:
748
760
  _private_key = asyncssh.import_private_key(self.private_key, self.passphrase)
749
761
  conn_config["client_keys"] = [_private_key]
@@ -33,6 +33,12 @@ def get_base_airflow_version_tuple() -> tuple[int, int, int]:
33
33
 
34
34
 
35
35
  AIRFLOW_V_3_0_PLUS = get_base_airflow_version_tuple() >= (3, 0, 0)
36
+ AIRFLOW_V_3_1_PLUS: bool = get_base_airflow_version_tuple() >= (3, 1, 0)
37
+
38
+ if AIRFLOW_V_3_1_PLUS:
39
+ from airflow.sdk import BaseHook
40
+ else:
41
+ from airflow.hooks.base import BaseHook # type: ignore[attr-defined,no-redef]
36
42
 
37
43
  if AIRFLOW_V_3_0_PLUS:
38
44
  from airflow.sdk import BaseOperator, BaseSensorOperator, PokeReturnValue
@@ -40,4 +46,4 @@ else:
40
46
  from airflow.models import BaseOperator
41
47
  from airflow.sensors.base import BaseSensorOperator, PokeReturnValue # type: ignore[no-redef]
42
48
 
43
- __all__ = ["AIRFLOW_V_3_0_PLUS", "BaseOperator", "BaseSensorOperator", "PokeReturnValue"]
49
+ __all__ = ["AIRFLOW_V_3_0_PLUS", "BaseHook", "BaseOperator", "BaseSensorOperator", "PokeReturnValue"]
@@ -1,11 +1,11 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: apache-airflow-providers-sftp
3
- Version: 5.3.2rc1
3
+ Version: 5.3.3
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>
7
7
  Maintainer-email: Apache Software Foundation <dev@airflow.apache.org>
8
- Requires-Python: ~=3.10
8
+ Requires-Python: >=3.10
9
9
  Description-Content-Type: text/x-rst
10
10
  Classifier: Development Status :: 5 - Production/Stable
11
11
  Classifier: Environment :: Console
@@ -18,16 +18,17 @@ Classifier: License :: OSI Approved :: Apache Software License
18
18
  Classifier: Programming Language :: Python :: 3.10
19
19
  Classifier: Programming Language :: Python :: 3.11
20
20
  Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Programming Language :: Python :: 3.13
21
22
  Classifier: Topic :: System :: Monitoring
22
- Requires-Dist: apache-airflow>=2.10.0rc1
23
- Requires-Dist: apache-airflow-providers-ssh>=2.1.0rc1
23
+ Requires-Dist: apache-airflow>=2.10.0
24
+ Requires-Dist: apache-airflow-providers-ssh>=4.0.0
24
25
  Requires-Dist: paramiko>=2.9.0
25
26
  Requires-Dist: asyncssh>=2.12.0
26
27
  Requires-Dist: apache-airflow-providers-common-compat ; extra == "common-compat"
27
28
  Requires-Dist: apache-airflow-providers-openlineage ; extra == "openlineage"
28
29
  Project-URL: Bug Tracker, https://github.com/apache/airflow/issues
29
- Project-URL: Changelog, https://airflow.staged.apache.org/docs/apache-airflow-providers-sftp/5.3.2/changelog.html
30
- Project-URL: Documentation, https://airflow.staged.apache.org/docs/apache-airflow-providers-sftp/5.3.2
30
+ Project-URL: Changelog, https://airflow.apache.org/docs/apache-airflow-providers-sftp/5.3.3/changelog.html
31
+ Project-URL: Documentation, https://airflow.apache.org/docs/apache-airflow-providers-sftp/5.3.3
31
32
  Project-URL: Mastodon, https://fosstodon.org/@airflow
32
33
  Project-URL: Slack Chat, https://s.apache.org/airflow-slack
33
34
  Project-URL: Source Code, https://github.com/apache/airflow
@@ -60,8 +61,9 @@ Provides-Extra: openlineage
60
61
 
61
62
  Package ``apache-airflow-providers-sftp``
62
63
 
63
- Release: ``5.3.2``
64
+ Release: ``5.3.3``
64
65
 
66
+ Release Date: ``|PypiReleaseDate|``
65
67
 
66
68
  `SSH File Transfer Protocol (SFTP) <https://tools.ietf.org/wg/secsh/draft-ietf-secsh-filexfer/>`__
67
69
 
@@ -73,7 +75,7 @@ This is a provider package for ``sftp`` provider. All classes for this provider
73
75
  are in ``airflow.providers.sftp`` python package.
74
76
 
75
77
  You can find package information and changelog for the provider
76
- in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-sftp/5.3.2/>`_.
78
+ in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-sftp/5.3.3/>`_.
77
79
 
78
80
  Installation
79
81
  ------------
@@ -82,7 +84,7 @@ You can install this package on top of an existing Airflow 2 installation (see `
82
84
  for the minimum Airflow version supported) via
83
85
  ``pip install apache-airflow-providers-sftp``
84
86
 
85
- The package supports the following python versions: 3.10,3.11,3.12
87
+ The package supports the following python versions: 3.10,3.11,3.12,3.13
86
88
 
87
89
  Requirements
88
90
  ------------
@@ -91,7 +93,7 @@ Requirements
91
93
  PIP package Version required
92
94
  ================================ ==================
93
95
  ``apache-airflow`` ``>=2.10.0``
94
- ``apache-airflow-providers-ssh`` ``>=2.1.0``
96
+ ``apache-airflow-providers-ssh`` ``>=4.0.0``
95
97
  ``paramiko`` ``>=2.9.0``
96
98
  ``asyncssh`` ``>=2.12.0``
97
99
  ================================ ==================
@@ -118,5 +120,5 @@ Dependent package
118
120
  ================================================================================================================== =================
119
121
 
120
122
  The changelog for the provider package can be found in the
121
- `changelog <https://airflow.apache.org/docs/apache-airflow-providers-sftp/5.3.2/changelog.html>`_.
123
+ `changelog <https://airflow.apache.org/docs/apache-airflow-providers-sftp/5.3.3/changelog.html>`_.
122
124
 
@@ -1,19 +1,19 @@
1
1
  airflow/providers/sftp/LICENSE,sha256=gXPVwptPlW1TJ4HSuG5OMPg-a3h43OGMkZRR1rpwfJA,10850
2
- airflow/providers/sftp/__init__.py,sha256=lYds5hVWJaOJ-sr51-Qfkf9774cZ2GXP9aJGOj5sogM,1493
2
+ airflow/providers/sftp/__init__.py,sha256=2awxmKDxrrpstvCBQStlSJlp5fuVcoqW0wnk-CMLJR8,1493
3
3
  airflow/providers/sftp/get_provider_info.py,sha256=_IqUGQ-rKpZsSAsXdTsGYzfzJ3X57duhn-2b0-rFOz0,2905
4
- airflow/providers/sftp/version_compat.py,sha256=No2jWhkrX-sJqYuntfvfkrnyt6hRu4Gqg4YnUMePLHE,1878
4
+ airflow/providers/sftp/version_compat.py,sha256=zRB-sKs65ic8Gl2QARSOaJ8ScjIRw58pt0kR6nOQPPY,2113
5
5
  airflow/providers/sftp/decorators/__init__.py,sha256=9hdXHABrVpkbpjZgUft39kOFL2xSGeG4GEua0Hmelus,785
6
6
  airflow/providers/sftp/decorators/sensors/__init__.py,sha256=9hdXHABrVpkbpjZgUft39kOFL2xSGeG4GEua0Hmelus,785
7
7
  airflow/providers/sftp/decorators/sensors/sftp.py,sha256=O-rkLJ_-B49aRZ5W9vpHcCeMo5bA1DOm_iVdKp8lwLE,3134
8
8
  airflow/providers/sftp/hooks/__init__.py,sha256=9hdXHABrVpkbpjZgUft39kOFL2xSGeG4GEua0Hmelus,785
9
- airflow/providers/sftp/hooks/sftp.py,sha256=SzyF8JZwmn09qIkBf9zEqE6C-xkxhUByjrCbRrbXcUQ,32520
9
+ airflow/providers/sftp/hooks/sftp.py,sha256=grPNYDOCZLKApVGFSB-cs6FYtvEAsqM2T4HPEDsEMY8,33513
10
10
  airflow/providers/sftp/operators/__init__.py,sha256=9hdXHABrVpkbpjZgUft39kOFL2xSGeG4GEua0Hmelus,785
11
11
  airflow/providers/sftp/operators/sftp.py,sha256=O7vpg6GrBKjSjvrTHat7JVlKIgKaJOSf4awFkY9h5Wo,12963
12
12
  airflow/providers/sftp/sensors/__init__.py,sha256=9hdXHABrVpkbpjZgUft39kOFL2xSGeG4GEua0Hmelus,785
13
13
  airflow/providers/sftp/sensors/sftp.py,sha256=NlluZ-UHwL8gzWMOa-QWkJ-ETI3G9w9PMfqxsfBywJA,8487
14
14
  airflow/providers/sftp/triggers/__init__.py,sha256=9hdXHABrVpkbpjZgUft39kOFL2xSGeG4GEua0Hmelus,785
15
15
  airflow/providers/sftp/triggers/sftp.py,sha256=fSi-I5FocNQblHt4GYfGispFgOOl8XQ9Vk9ZFLcv_Sw,6182
16
- apache_airflow_providers_sftp-5.3.2rc1.dist-info/entry_points.txt,sha256=Fa1IkUHV6qnIuwLd0U7tKoklbLXXVrbB2hhG6N7Q-zo,100
17
- apache_airflow_providers_sftp-5.3.2rc1.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82
18
- apache_airflow_providers_sftp-5.3.2rc1.dist-info/METADATA,sha256=TZ5Xbnlhv5p7VepXs-Z4uazx-C0fApa8tXGGio3iZxA,5649
19
- apache_airflow_providers_sftp-5.3.2rc1.dist-info/RECORD,,
16
+ apache_airflow_providers_sftp-5.3.3.dist-info/entry_points.txt,sha256=Fa1IkUHV6qnIuwLd0U7tKoklbLXXVrbB2hhG6N7Q-zo,100
17
+ apache_airflow_providers_sftp-5.3.3.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82
18
+ apache_airflow_providers_sftp-5.3.3.dist-info/METADATA,sha256=R9YKXFqeYX0qv8zwXQL2W_Aq_oQs5v5yEkkcQD8F4RA,5718
19
+ apache_airflow_providers_sftp-5.3.3.dist-info/RECORD,,