./python
Python 3.13.0a0 (heads/main:58906213cc, Jul 3 2023, 21:54:53) [GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import datetime
>>> datetime.datetime.utcnow()
<stdin>:1: DeprecationWarning: datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.now(datetime.UTC).
datetime.datetime(2023, 7, 4, 12, 41, 45, 658447)
>>> datetime.datetime.utcfromtimestamp(10000)
<stdin>:1: DeprecationWarning: datetime.utcfromtimestamp() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.fromtimestamp(timestamp, datetime.UTC).
datetime.datetime(1970, 1, 1, 2, 46, 40)
Apache Airflow version
2.6.2
What happened
The usage of
datetime.utcnowis deprecated in Python 3.12 and it can be replaced withairflow.utils.timezone.utcnowand a similar method can be introduced for utcfromtimestamp too in timezone moduleWhat you think should happen instead
No response
How to reproduce
Operating System
Ubuntu
Versions of Apache Airflow Providers
No response
Deployment
Virtualenv installation
Deployment details
No response
Anything else
No response
Are you willing to submit PR?
Code of Conduct