datetime.utcnow and datetime.utcfromtimestamp will be deprecated in 3.12: github.com/python/cpython/issu

If you maintain a package, now is probably a good time to grep your source code for utcnow and utcfromtimestamp to get out ahead of the deprecation warnings. 📅🕐

@pganssle Why not make them do the right thing and include the utc timezone instead of no timezone?

Follow

@tewalds That would break backwards compatibility in a much more subtle way, and create a situation where its difficult to tell whether or not you are in compliance. You wouldn’t be able to just grep for uses of utcnow, and we would have no way of warning you that at some point your code will break.

There’s also no easy way to “opt-in” to the new behavior like there is with just not using utcnow and utcfromtimestamp.

It is better to remove these entirely.

Sign in to participate in the conversation
Qoto Mastodon

QOTO: Question Others to Teach Ourselves
An inclusive, Academic Freedom, instance
All cultures welcome.
Hate speech and harassment strictly forbidden.