Open mborsetti opened 1 month ago
Our policy is to maintain support for CPython versions for one year after they go unsupported by the PSF.
Python 3.8 became unsupported on 2024-10-07, so we have roughly 11 months to go before we can rely solely on datetime
's tzinfo
objects.
That said, this is definitely the right approach, and it's worth looking at how we can isolate the use of pytz
so that it doesn't impact Python 3.9 or later.
That said, I just checked Python3.8, and it appears to have tzinfo
objects present, so we might be able to drop pytz
? I'll have a look in more detail.
Apologies, it's zoneinfo
I was trying to refer to (not sure how I got confused by the tzinfo
!):
https://docs.python.org/3/library/zoneinfo.html
It's supported in Python 3.8 through backports.zoneinfo:
try:
from zoneinfo import ZoneInfo
except ImportError:
from backports.zoneinfo import ZoneInfo
Just add in requirements.txt:
backports.zoneinfo; python_version < '3.9'
tzdata; sys_platform == 'win32'
(the second one is required by zoneinfo in Windows since the OS does not come preloaded with timezone info; it's all in the library documentation)
tzinfo
was introduced with Python 3.9 four years ago, and strongly suggest eliminating this package's requirement on a now-unneded external library.https://python.readthedocs.io/en/latest/library/datetime.html#tzinfo-objects