From a31cd0bf588dbe954b549026264dea6d8bd64f0a Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Tue, 1 Oct 2024 11:47:54 +0900 Subject: [PATCH] Remove Python 3.8 support Python 3.8 is no longer part of the tested runtimes for 2024.2[1] because its EOL is coming soon. [1] https://governance.openstack.org/tc/reference/runtimes/2024.2.html This allows us to replace external pytz library by built-in zoneinfo module which was added in Python 3.9 . Change-Id: I611f5f2ec305671c97cffc78d26cc29bd556394d --- pycadf/timestamp.py | 9 ++++----- releasenotes/notes/remove-py38-0cb8ed123d41888b.yaml | 5 +++++ requirements.txt | 1 - setup.cfg | 3 +-- 4 files changed, 10 insertions(+), 8 deletions(-) create mode 100644 releasenotes/notes/remove-py38-0cb8ed123d41888b.yaml 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