Documentation
Currently, the deprecation notice for datetime.utcnow() reads:
Deprecated since version 3.12: Use datetime.now() with UTC instead.
Unfortunately, applying this suggestion verbatim can easily break user code – especially when applying it to libraries. (See for example https://foss.heptapod.net/openpyxl/openpyxl/-/issues/2051). These datetime-related TypeErrors are easy to introduce, and fairly hard to fix. I suggest to amend the deprecation notice:
Deprecated since version 3.12: Use datetime.now(UTC) instead. Please note that this will return an aware datetime object. If you need to remain compatible, use datetime.now(UTC).replace(tzinfo=None).
Maybe someone can come up with a better wording.
Linked PRs
Documentation
Currently, the deprecation notice for
datetime.utcnow()reads:Unfortunately, applying this suggestion verbatim can easily break user code – especially when applying it to libraries. (See for example https://foss.heptapod.net/openpyxl/openpyxl/-/issues/2051). These datetime-related TypeErrors are easy to introduce, and fairly hard to fix. I suggest to amend the deprecation notice:
Maybe someone can come up with a better wording.
Linked PRs