You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[TECH DEBT] datetime.datetime.utcnow() is deprecated in Python 3.12 #65604
Description of the tech debt to be addressed, include links and screenshots
Using salt-ssh results in the following warning:
/usr/lib/python3.12/site-packages/salt/utils/jid.py:19: DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.now(datetime.UTC).
Versions Report
(Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)
This is salt-ssh called from/to Fedora 39
Salt Version:
Salt: 3006.4
Python Version:
Python: 3.12.0 (main, Oct 2 2023, 00:00:00) [GCC 13.2.1 20230918 (Red Hat 13.2.1-3)]
Dependency Versions:
cffi: 1.15.1
cherrypy: Not Installed
dateutil: 2.8.2
docker-py: Not Installed
gitdb: Not Installed
gitpython: Not Installed
Jinja2: 3.1.2
libgit2: Not Installed
looseversion: 1.3.0
M2Crypto: Not Installed
Mako: Not Installed
msgpack: 1.0.5
msgpack-pure: Not Installed
mysql-python: Not Installed
packaging: 23.1
pycparser: 2.20
pycrypto: Not Installed
pycryptodome: 3.19.0
pygit2: Not Installed
python-gnupg: Not Installed
PyYAML: 6.0.1
PyZMQ: 25.1.0
relenv: Not Installed
smmap: Not Installed
timelib: Not Installed
Tornado: 6.3.3
ZMQ: 4.3.4
System Versions:
dist: fedora 39
locale: utf-8
machine: x86_64
release: 6.5.10-1.qubes.fc37.x86_64
system: Linux
version: Fedora Linux 39
Fixed on 3007.x/3008.x/master by 6330657 (salt/utils/jid.py uses datetime.datetime.now(tz=datetime.timezone.utc)). Remaining utcnow() calls on non-LTS branches are in salt/utils/timeutil.py (the intentional Py<3.12 wrapper) plus a suppress-filter in salt/__init__.py. 3006.x is LTS and does not target Python 3.12. Closing.
Activity
s0undt3ch commentedon Nov 23, 2023
This should be fairly trivial to fix
Then, every occurrence of:
Should get replaced by:
We'd love to get a PR addressing this 😁
refactor: replace all occurences of deprecated method datetime.utcnow…
refactor: replace all occurences of deprecated method datetime.utcnow…
gabrielrosendo commentedon Feb 10, 2024
Is this open?
Update Plugwise-2.py with timezone
Fix some of the DeprecationWarning about datetime.datetime.utcnow
Fix some of the DeprecationWarning about datetime.datetime.utcnow
Use timezone-aware datetime objects, for UTC too
Use timezone-aware datetime objects, for UTC too
Use timezone-aware datetime objects, for UTC too
Use timezone-aware datetime objects, for UTC too
Use timezone-aware datetime objects, for UTC too
1 remaining item
Use timezone-aware datetime objects, for UTC too
Use timezone-aware datetime objects, for UTC too
Use timezone-aware datetime objects, for UTC too
Use timezone-aware datetime objects, for UTC too
Replace deprecated datetime.utcnow() with timezone-aware datetime.now…
dwoz commentedon Jul 2, 2026
Fixed on 3007.x/3008.x/master by 6330657 (
salt/utils/jid.pyusesdatetime.datetime.now(tz=datetime.timezone.utc)). Remainingutcnow()calls on non-LTS branches are insalt/utils/timeutil.py(the intentional Py<3.12 wrapper) plus a suppress-filter insalt/__init__.py. 3006.x is LTS and does not target Python 3.12. Closing.