diff --git a/pycadf/timestamp.py b/pycadf/timestamp.py index 4ad1c70..43fd233 100644 --- a/pycadf/timestamp.py +++ b/pycadf/timestamp.py @@ -13,8 +13,7 @@ # the License. import datetime - -import pytz +import zoneinfo TIME_FORMAT = "%Y-%m-%dT%H:%M:%S.%f%z" @@ -24,11 +23,11 @@ def get_utc_now(timezone=None): :param timezone: an optional timezone param to offset time to. """ - utc_datetime = pytz.utc.localize(datetime.datetime.now( - datetime.timezone.utc).replace(tzinfo=None)) + utc_datetime = datetime.datetime.now(datetime.timezone.utc) if timezone is not None: try: - utc_datetime = utc_datetime.astimezone(pytz.timezone(timezone)) + tz = zoneinfo.Zoneinfo(timezone) + utc_datetime = utc_datetime.astimezone(tz=tz) except Exception: utc_datetime.strftime(TIME_FORMAT) return utc_datetime.strftime(TIME_FORMAT) diff --git a/releasenotes/notes/remove-py38-0cb8ed123d41888b.yaml b/releasenotes/notes/remove-py38-0cb8ed123d41888b.yaml new file mode 100644 index 0000000..0403163 --- /dev/null +++ b/releasenotes/notes/remove-py38-0cb8ed123d41888b.yaml @@ -0,0 +1,5 @@ +--- +upgrade: + - | + Support for Python 3.8 has been removed. Now the minimum python version + supported is 3.9 . diff --git a/requirements.txt b/requirements.txt index e394942..67a8377 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,4 +3,3 @@ # you find any incorrect lower bounds, let us know or propose a fix. oslo.config>=5.2.0 # Apache-2.0 oslo.serialization!=2.19.1,>=2.18.0 # Apache-2.0 -pytz>=2013.6 # MIT diff --git a/setup.cfg b/setup.cfg index 6c98c6e..c5a8c99 100644 --- a/setup.cfg +++ b/setup.cfg @@ -6,7 +6,7 @@ summary = CADF Library description-file = README.rst home-page = https://docs.openstack.org/pycadf/latest/ -python-requires = >=3.8 +python-requires = >=3.9 classifier = Development Status :: 5 - Production/Stable Environment :: OpenStack @@ -17,7 +17,6 @@ classifier = Programming Language :: Python Programming Language :: Python :: 3 :: Only Programming Language :: Python :: 3 - Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.9 Programming Language :: Python :: 3.10 Programming Language :: Python :: 3.11