beanlab / quest_framework

A Python framework for fault-tolerant workflows
0 stars 0 forks source link

Andrew / Fixes UTC method deprecation #9

Closed ABCambridge closed 3 months ago

ABCambridge commented 5 months ago

I ran main.py on my laptop with Python 3.12, which completed successfully but gave me a deprecation warning about using datetime.utcnow().isoformat() due to its deprecation and future removal, and recommended switching over to datetime.now(UTC).isoformat(). I read the information on this article for some confirmation and context, and then tested the change.

Nothing breaks as a result of this change, but the isoformat() produces a slightly different string on the new version (see console snippet below). If we're okay with that difference, then it should support compatibility with future versions of Python.

>>> datetime.utcnow().isoformat()
'2024-01-24T15:25:57.382516'
>>> datetime.now(UTC).isoformat()
'2024-01-24T15:26:03.174397+00:00'