diff --git a/oslo_utils/timeutils.py b/oslo_utils/timeutils.py index 8cd810c8..fe07b255 100644 --- a/oslo_utils/timeutils.py +++ b/oslo_utils/timeutils.py @@ -22,15 +22,10 @@ import datetime import functools import logging import time +import zoneinfo import iso8601 -try: - import zoneinfo -except ImportError: - # zoneinfo is available in Python >= 3.9 - import pytz - zoneinfo = None from oslo_utils import reflection @@ -233,13 +228,8 @@ def unmarshall_time(tyme): if tzname: # Need to handle either iso8601 or python UTC format tzname = 'UTC' if tzname == 'UTC+00:00' else tzname - - if zoneinfo: - tzinfo = zoneinfo.ZoneInfo(tzname) - dt = dt.replace(tzinfo=tzinfo) - else: - tzinfo = pytz.timezone(tzname) - dt = tzinfo.localize(dt) + tzinfo = zoneinfo.ZoneInfo(tzname) + dt = dt.replace(tzinfo=tzinfo) return dt diff --git a/releasenotes/notes/remove-py38-a22bb6c463f92868.yaml b/releasenotes/notes/remove-py38-a22bb6c463f92868.yaml new file mode 100644 index 00000000..04031636 --- /dev/null +++ b/releasenotes/notes/remove-py38-a22bb6c463f92868.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 07fe8673..2ca05465 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,11 +5,10 @@ iso8601>=0.1.11 # MIT oslo.i18n>=3.15.3 # Apache-2.0 -pytz>=2013.6;python_version<"3.9" # MIT netaddr>=0.10.0 # BSD netifaces>=0.10.4 # MIT debtcollector>=1.2.0 # Apache-2.0 pyparsing>=2.1.0 # MIT packaging>=20.4 # BSD -tzdata>=2022.4;python_version>="3.9" # MIT +tzdata>=2022.4 # MIT PyYAML>=3.13 # MIT diff --git a/setup.cfg b/setup.cfg index 0c767c4c..551bd5d7 100644 --- a/setup.cfg +++ b/setup.cfg @@ -6,7 +6,7 @@ description_file = author = OpenStack author_email = openstack-discuss@lists.openstack.org home_page = https://docs.openstack.org/oslo.utils/latest/ -python_requires = >=3.8 +python_requires = >=3.9 classifier = Environment :: OpenStack Intended Audience :: Information Technology @@ -15,7 +15,6 @@ classifier = Operating System :: POSIX :: Linux Programming Language :: Python Programming Language :: Python :: 3 - Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.9 Programming Language :: Python :: 3.10 Programming Language :: Python :: 3.11