Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update version support #168

Merged
merged 1 commit into from
Feb 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
2 changes: 1 addition & 1 deletion CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 1 addition & 4 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ This Python module returns the `IANA time zone name
<https://www.iana.org/time-zones>`_ 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
Expand Down Expand Up @@ -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')
Expand Down
5 changes: 2 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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'",
]

Expand Down
5 changes: 1 addition & 4 deletions tests/test_tzlocal.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
5 changes: 1 addition & 4 deletions tzlocal/unix.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 1 addition & 5 deletions tzlocal/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
5 changes: 1 addition & 4 deletions tzlocal/win32.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down