From a8431f079745267e8f76c1ecfe11f0b88c5412a7 Mon Sep 17 00:00:00 2001 From: Richard Shadrach Date: Thu, 11 Dec 2025 16:43:57 -0500 Subject: [PATCH 1/4] DEP: Remove tzdata as a hard dependency outside of Windows --- README.md | 2 +- doc/source/getting_started/install.rst | 4 +++- doc/source/whatsnew/v3.0.0.rst | 2 -- pandas/_libs/tslibs/timezones.pyx | 3 --- pyproject.toml | 2 +- 5 files changed, 5 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index c6e0a4b319930..407985b197e5e 100644 --- a/README.md +++ b/README.md @@ -115,7 +115,7 @@ details, see the commit logs at https://github.com/pandas-dev/pandas. ## Dependencies - [NumPy - Adds support for large, multi-dimensional arrays, matrices and high-level mathematical functions to operate on these arrays](https://www.numpy.org) - [python-dateutil - Provides powerful extensions to the standard datetime module](https://dateutil.readthedocs.io/en/stable/index.html) -- [tzdata - Provides an IANA time zone database](https://tzdata.readthedocs.io/en/latest/) +- [tzdata - Provides an IANA time zone database](https://tzdata.readthedocs.io/en/latest/) (Only required on Windows) See the [full installation instructions](https://pandas.pydata.org/pandas-docs/stable/install.html#dependencies) for minimum supported versions of required, recommended and optional dependencies. diff --git a/doc/source/getting_started/install.rst b/doc/source/getting_started/install.rst index bb3290e18e26b..ed92eecf67208 100644 --- a/doc/source/getting_started/install.rst +++ b/doc/source/getting_started/install.rst @@ -150,11 +150,13 @@ Package Minimum support ================================================================ ========================== `NumPy `__ 1.26.0 `python-dateutil `__ 2.8.2 -`tzdata `__ 2023.3 +*`tzdata `__ 2023.3 ================================================================ ========================== Generally, the minimum supported version is ~2 years old from the release date of a major or minor pandas version. +* ``tzdata`` is only required on Windows. + .. _install.optional_dependencies: Optional dependencies diff --git a/doc/source/whatsnew/v3.0.0.rst b/doc/source/whatsnew/v3.0.0.rst index bebd928924214..33ddd7243ab67 100644 --- a/doc/source/whatsnew/v3.0.0.rst +++ b/doc/source/whatsnew/v3.0.0.rst @@ -657,8 +657,6 @@ The following required dependencies were updated: +=================+======================+ | numpy | 1.26.0 | +-----------------+----------------------+ -| tzdata | 2023.3 | -+-----------------+----------------------+ For `optional libraries `_ the general recommendation is to use the latest version. The following table lists the lowest version per library that is currently being tested throughout the development of pandas. diff --git a/pandas/_libs/tslibs/timezones.pyx b/pandas/_libs/tslibs/timezones.pyx index b02ddbcaf18e9..8218c5196e0c0 100644 --- a/pandas/_libs/tslibs/timezones.pyx +++ b/pandas/_libs/tslibs/timezones.pyx @@ -59,9 +59,6 @@ cdef bint is_utc_zoneinfo(tzinfo tz): utc_zoneinfo = zoneinfo.ZoneInfo("UTC") except zoneinfo.ZoneInfoNotFoundError: return False - # Warn if tzdata is too old, even if there is a system tzdata to alert - # users about the mismatch between local/system tzdata - import_optional_dependency("tzdata", errors="warn", min_version="2022.7") return tz is utc_zoneinfo diff --git a/pyproject.toml b/pyproject.toml index cd151ad7bbe27..d085a6991fedf 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -29,7 +29,7 @@ requires-python = '>=3.11' dependencies = [ "numpy>=1.26.0", "python-dateutil>=2.8.2", - "tzdata>=2023.3" + "tzdata>=2023.3; platform_system == 'Windows'", ] classifiers = [ 'Development Status :: 5 - Production/Stable', From de32dd2c697683612e76115ec67a2b3c1c5612ea Mon Sep 17 00:00:00 2001 From: Richard Shadrach Date: Sat, 13 Dec 2025 08:18:55 -0500 Subject: [PATCH 2/4] Fixup --- doc/source/getting_started/install.rst | 6 +++--- pyproject.toml | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/doc/source/getting_started/install.rst b/doc/source/getting_started/install.rst index ed92eecf67208..07388e97039fa 100644 --- a/doc/source/getting_started/install.rst +++ b/doc/source/getting_started/install.rst @@ -150,12 +150,12 @@ Package Minimum support ================================================================ ========================== `NumPy `__ 1.26.0 `python-dateutil `__ 2.8.2 -*`tzdata `__ 2023.3 + `tzdata `__ \* 2023.3 ================================================================ ========================== -Generally, the minimum supported version is ~2 years old from the release date of a major or minor pandas version. +\* ``tzdata`` is only required on Windows and Pyodide (Emscripten). -* ``tzdata`` is only required on Windows. +Generally, the minimum supported version is ~2 years old from the release date of a major or minor pandas version. .. _install.optional_dependencies: diff --git a/pyproject.toml b/pyproject.toml index d085a6991fedf..04046840590fe 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -30,6 +30,8 @@ dependencies = [ "numpy>=1.26.0", "python-dateutil>=2.8.2", "tzdata>=2023.3; platform_system == 'Windows'", + # Emscripten is the platform system for Pyodide. + "tzdata>=2023.3; platform_system == 'Emscripten'", ] classifiers = [ 'Development Status :: 5 - Production/Stable', From d8bc8375161b69dc77f5aee7ea2dc6a1131f72b0 Mon Sep 17 00:00:00 2001 From: Richard Shadrach Date: Wed, 17 Dec 2025 18:08:36 -0500 Subject: [PATCH 3/4] Add tests for error message --- pandas/tests/tslibs/test_timezones.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/pandas/tests/tslibs/test_timezones.py b/pandas/tests/tslibs/test_timezones.py index d3bce7b4bbf65..90cba5f08788c 100644 --- a/pandas/tests/tslibs/test_timezones.py +++ b/pandas/tests/tslibs/test_timezones.py @@ -3,6 +3,9 @@ timedelta, timezone, ) +import subprocess +import sys +import textwrap import dateutil.tz import pytest @@ -16,6 +19,24 @@ from pandas import Timestamp +def test_no_timezone_data(): + # https://github.com/pandas-dev/pandas/pull/63335 + # Test error message when timezone data is not available. + msg = "'No time zone found with key Europe/Brussels'" + code = textwrap.dedent( + f"""\ + import sys, zoneinfo, pandas as pd + sys.modules['tzdata'] = None + zoneinfo.reset_tzpath(['/path/to/nowhere']) + try: + pd.to_datetime('2012-01-01').tz_localize('Europe/Brussels') + except zoneinfo.ZoneInfoNotFoundError as err: + assert str(err) == "{msg}" + """ + ) + subprocess.check_call([sys.executable, "-c", code]) + + def test_is_utc(utc_fixture): tz = timezones.maybe_get_tz(utc_fixture) assert timezones.is_utc(tz) From 2fa15ec8bf8209e7cc35e3b954896c9a0a23509c Mon Sep 17 00:00:00 2001 From: Richard Shadrach Date: Wed, 17 Dec 2025 18:09:23 -0500 Subject: [PATCH 4/4] Add tests for error message --- pandas/tests/tslibs/test_timezones.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pandas/tests/tslibs/test_timezones.py b/pandas/tests/tslibs/test_timezones.py index 90cba5f08788c..c48986c597356 100644 --- a/pandas/tests/tslibs/test_timezones.py +++ b/pandas/tests/tslibs/test_timezones.py @@ -19,6 +19,7 @@ from pandas import Timestamp +@pytest.mark.single_cpu def test_no_timezone_data(): # https://github.com/pandas-dev/pandas/pull/63335 # Test error message when timezone data is not available.