diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 65ea546..91c61c6 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -11,14 +11,18 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, macos-latest, windows-latest] - python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "pypy3.8"] + python-version: ["3.9", "3.13", "3.14-dev", "pypy3.10"] exclude: - os: macos-latest - python-version: 3.8 + python-version: 3.9 + - os: macos-latest + python-version: 3.13 - os: macos-latest python-version: pypy3 - os: windows-latest - python-version: 3.8 + python-version: 3.9 + - os: windows-latest + python-version: 3.13 - os: windows-latest python-version: pypy3 runs-on: ${{ matrix.os }} diff --git a/CHANGES.txt b/CHANGES.txt index 7ebe8eb..2b61888 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -4,7 +4,7 @@ Changes 5.3 (unreleased) ---------------- -- Nothing changed yet. +- Now supports Python 3.9 to 3.13, and no longer requires backports.zoneinfo. 5.2 (2023-10-22) diff --git a/README.rst b/README.rst index 4d94e92..1b931c8 100644 --- a/README.rst +++ b/README.rst @@ -30,9 +30,6 @@ This Python module returns the `IANA time zone name `_ for your local time zone or a ``tzinfo`` object with the local timezone information, under Unix and Windows. -It requires Python 3.8 or later, and will use the ``backports.zoneinfo`` -package, for Python 3.8. - This module attempts to fix a glaring hole in the ``pytz`` and ``zoneinfo`` modules, that there is no way to get the local timezone information, unless you know the zoneinfo name, and under several Linux distros that's hard or @@ -113,7 +110,7 @@ Create a local datetime: >>> dt datetime.datetime(2015, 4, 10, 7, 22, tzinfo=zoneinfo.ZoneInfo(key='Europe/Warsaw')) -Lookup another timezone with ``zoneinfo`` (``backports.zoneinfo`` on Python 3.8 or earlier): +Lookup another timezone with ``zoneinfo``: >>> from zoneinfo import ZoneInfo >>> eastern = ZoneInfo('US/Eastern') diff --git a/pyproject.toml b/pyproject.toml index f10aab4..6981867 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -17,15 +17,14 @@ classifiers = [ "Operating System :: Unix", "Operating System :: MacOS :: MacOS X", "Typing :: Typed", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", ] -requires-python = ">= 3.8" +requires-python = ">= 3.9" dependencies = [ - "backports.zoneinfo; python_version < '3.9'", "tzdata; platform_system == 'Windows'", ] diff --git a/tests/test_tzlocal.py b/tests/test_tzlocal.py index f18ef00..46ae0c4 100644 --- a/tests/test_tzlocal.py +++ b/tests/test_tzlocal.py @@ -10,10 +10,7 @@ import tzlocal.unix import tzlocal.utils -if sys.version_info >= (3, 9): - from zoneinfo import ZoneInfo, ZoneInfoNotFoundError -else: - from backports.zoneinfo import ZoneInfo, ZoneInfoNotFoundError +from zoneinfo import ZoneInfo, ZoneInfoNotFoundError import logging diff --git a/tzlocal/unix.py b/tzlocal/unix.py index 117c18d..a70a52a 100644 --- a/tzlocal/unix.py +++ b/tzlocal/unix.py @@ -7,10 +7,7 @@ from tzlocal import utils -if sys.version_info >= (3, 9): - import zoneinfo # pragma: no cover -else: - from backports import zoneinfo # pragma: no cover +import zoneinfo _cache_tz = None _cache_tz_name = None diff --git a/tzlocal/utils.py b/tzlocal/utils.py index 3990535..5a0b72e 100644 --- a/tzlocal/utils.py +++ b/tzlocal/utils.py @@ -4,11 +4,7 @@ import os import time import warnings - -try: - import zoneinfo # pragma: no cover -except ImportError: - from backports import zoneinfo # pragma: no cover +import zoneinfo from tzlocal import windows_tz diff --git a/tzlocal/win32.py b/tzlocal/win32.py index 2fa59fe..cfcdba5 100644 --- a/tzlocal/win32.py +++ b/tzlocal/win32.py @@ -6,10 +6,7 @@ except ImportError: import winreg -try: - import zoneinfo # pragma: no cover -except ImportError: - from backports import zoneinfo # pragma: no cover +import zoneinfo from tzlocal import utils from tzlocal.windows_tz import win_tz