202201142 opened a new issue, #65419:
URL: https://github.com/apache/airflow/issues/65419

   ### Under which category would you file this issue?
   
   Providers
   
   ### Apache Airflow version
   
   3.1.8
   
   ### What happened and how to reproduce it?
   
   ### Summary
   
   Importing `SFTPSensor` (from `apache-airflow-providers-sftp`) on Airflow 
3.1.8 with Python 3.11 causes `DeprecatedImportWarning` due to usage of 
`airflow.utils.timezone` in SFTP provider code.
   
   <img width="1139" height="225" alt="Image" 
src="https://github.com/user-attachments/assets/c8fd0010-e261-4376-a4e6-2b0d20d920d1";
 />
   
   ### Current Behavior
   
   On importing or using SFTPSensor, log shows:
   
   [2026-04-17 18:35:28] INFO - Filling up the DagBag from 
/mnt/local/airflow/dagcodes/dags/utility/test.py  
   [2026-04-17 18:35:28] WARNING - The `airflow.utils.timezone.convert_to_utc` 
attribute is deprecated. Please use `'airflow.sdk.timezone.convert_to_utc'`. 
category=DeprecatedImportWarning  
   [2026-04-17 18:35:28] WARNING - The `airflow.utils.timezone.convert_to_utc` 
attribute is deprecated. Please use `'airflow.sdk.timezone.convert_to_utc'`. 
category=DeprecatedImportWarning  
   [2026-04-17 18:35:28] WARNING - The `airflow.utils.timezone.parse` attribute 
is deprecated. Please use `'airflow.sdk.timezone.parse'`. 
category=DeprecatedImportWarning  
   
   ### Reproduction Steps
   
   1. Airflow version: `3.1.8`  
   2. Python version: `3.11`  
   3. Executor/environment: `Celery`  
   4. Minimal DAG:
   
   ```python
   from datetime import datetime
   
   from airflow.sdk import DAG
   from airflow.providers.sftp.sensors.sftp import SFTPSensor
   
   with DAG(
       dag_id="repro_sftp_timezone_warning",
       start_date=datetime(2024, 1, 1),
       schedule=None,
       catchup=False,
   ):
       SFTPSensor(
           task_id="wait_for_file",
           path="/tmp/somefile.txt",
           sftp_conn_id="sftp_default",
       )
   ```
   
   ### Analysis
   providers/sftp/src/airflow/providers/sftp/sensors/sftp.py imports deprecated 
timezone path.
   Link: 
[sftp.py](https://github.com/apache/airflow/blob/main/providers/sftp/src/airflow/providers/sftp/sensors/sftp.py#L32)
   Same behavior observed in provider releases including 
apache-airflow-providers-sftp==5.7.0 and 5.7.3. 
   Link: 
[sftp_5.7.3.py](https://airflow.apache.org/docs/apache-airflow-providers-sftp/stable/_modules/airflow/providers/sftp/sensors/sftp.html)
   
   
   
   ### What you think should happen instead?
   
   No DeprecatedImportWarning should be emitted from provider internals on 
Airflow 3.x.
   Replace deprecated airflow.utils.timezone imports/usages with 
airflow.sdk.timezone in SFTP provider sensor(s).
   
   ### Operating System
   
   _No response_
   
   ### Deployment
   
   Docker-Compose
   
   ### Apache Airflow Provider(s)
   
   sftp
   
   ### Versions of Apache Airflow Providers
   
   `apache-airflow-providers-sftp             5.7.0
   `
   
   ### Official Helm Chart version
   
   Not Applicable
   
   ### Kubernetes Version
   
   _No response_
   
   ### Helm Chart configuration
   
   _No response_
   
   ### Docker Image customizations
   
   _No response_
   
   ### Anything else?
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [x] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [x] I agree to follow this project's [Code of 
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to