pip uses deprecated utcnow method · Issue #12005 · pypa/pip (original) (raw)

Thanks for the heads up. What's the recommended replacement that works in Python 3.7 - 3.12? I know from the Discourse thread that .now(datetime.UTC) is the recommended replacement, but that's only valid in 3.11+. As far as I can see, the backward compatible approach would be .now(timezone(timedelta(0))). Is that correct? It feels a bit verbose and non-obvious (nothing that a well-placed comment can't fix, of course!)

I've created #12007 to see if the fix here is as simple as I hope it is :-)

The cachecontrol problem will need to be raised with them, and we'll pick up the fix when they release one. I raised psf/cachecontrol#291 to flag it with them.