Skip to content

Commit

Permalink
Remove direct dependency on tzdata
Browse files Browse the repository at this point in the history
It shouldn't be necessary to have a hard dependency on tzdata. For most
distributions, the tzinfo module can access the built-in timezone data.
Otherwise, users can install tzdata directly.
  • Loading branch information
gotmax23 committed Feb 6, 2024
1 parent 3e3fec6 commit 7bbed31
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
2 changes: 0 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ classifiers = [

dependencies = [
"python-dateutil>=2.6",
"tzdata>=2020.1",
'backports.zoneinfo>=0.2.1; python_version < "3.9"',
'time-machine>=2.6.0; implementation_name != "pypy"',
'importlib-resources>=5.9.0; python_version < "3.9"'
Expand Down Expand Up @@ -50,7 +49,6 @@ python = ">=3.8"
python-dateutil = ">=2.6"
"backports.zoneinfo" = { version = ">=0.2.1", python = "<3.9" }
time-machine = { version = ">=2.6.0", markers = "implementation_name != 'pypy'", optional = true }
tzdata = ">=2020.1"
importlib-resources = { version = ">=5.9.0", python = "<3.9" }

[tool.poetry.group.test.dependencies]
Expand Down
8 changes: 2 additions & 6 deletions src/pendulum/tz/__init__.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
from __future__ import annotations

from pathlib import Path
from typing import cast

from pendulum.tz.local_timezone import get_local_timezone
from pendulum.tz.local_timezone import set_local_timezone
from pendulum.tz.local_timezone import test_local_timezone
from pendulum.tz.timezone import UTC
from pendulum.tz.timezone import FixedTimezone
from pendulum.tz.timezone import Timezone
from pendulum.utils._compat import resources
from pendulum.utils._zoneinfo import available_timezones


PRE_TRANSITION = "pre"
Expand All @@ -25,8 +22,7 @@ def timezones() -> tuple[str, ...]:
global _timezones

if _timezones is None:
with cast(Path, resources.files("tzdata").joinpath("zones")).open() as f:
_timezones = tuple(tz.strip() for tz in f.readlines())
_timezones = tuple(available_timezones())

return _timezones

Expand Down

0 comments on commit 7bbed31

Please sign in to comment.