Skip to content

Commit 2c4be54

Browse files
committed
fix: deprecate with warning pytz instead of deleting
1 parent 812539d commit 2c4be54

9 files changed

Lines changed: 27 additions & 10 deletions

ci/requirements-py3.10-min.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ dependencies:
99
- pytest-mock
1010
- pytest-timeout
1111
- python=3.10
12+
- pytz
1213
- requests
1314
- pip:
1415
- h5py==3.6.0

ci/requirements-py3.10.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ dependencies:
1919
- pytest-rerunfailures
2020
- conda-forge::pytest-remotedata # version in default channel is old
2121
- python=3.10
22+
- pytz
2223
- requests
2324
- scipy >= 1.7.2
2425
- statsmodels
2526
- pip:
2627
- nrel-pysam>=2.0
2728
- solarfactors
28-
- tzdata; platform_system == "Windows"

ci/requirements-py3.11.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ dependencies:
1919
- pytest-rerunfailures
2020
- conda-forge::pytest-remotedata # version in default channel is old
2121
- python=3.11
22+
- pytz
2223
- requests
2324
- scipy >= 1.7.2
2425
- statsmodels
2526
- pip:
2627
- nrel-pysam>=2.0
2728
- solarfactors
28-
- tzdata; platform_system == "Windows"

ci/requirements-py3.12.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ dependencies:
1919
- pytest-rerunfailures
2020
- conda-forge::pytest-remotedata # version in default channel is old
2121
- python=3.12
22+
- pytz
2223
- requests
2324
- scipy >= 1.7.2
2425
- statsmodels
2526
- pip:
2627
- nrel-pysam>=2.0
2728
- solarfactors
28-
- tzdata; platform_system == "Windows"

ci/requirements-py3.13.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ dependencies:
1919
- pytest-rerunfailures
2020
- conda-forge::pytest-remotedata # version in default channel is old
2121
- python=3.13
22+
- pytz
2223
- requests
2324
- scipy >= 1.7.2
2425
- statsmodels
2526
- pip:
2627
- nrel-pysam>=2.0
2728
- solarfactors
28-
- tzdata; platform_system == "Windows"

ci/requirements-py3.14.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ dependencies:
1919
- pytest-rerunfailures
2020
- conda-forge::pytest-remotedata # version in default channel is old
2121
- python=3.14
22+
- pytz
2223
- requests
2324
- scipy >= 1.7.2
2425
- statsmodels
2526
- pip:
2627
# - nrel-pysam>=2.0 # not available for py 3.14 as of 2025-11-03
2728
- solarfactors
28-
- tzdata; platform_system == "Windows"

docs/sphinx/source/whatsnew/v0.15.2.rst

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,6 @@ Benchmarking
4545

4646
Requirements
4747
~~~~~~~~~~~~
48-
* Removed ``pytz`` from core dependencies. ``zoneinfo`` (built into Python 3.9+)
49-
is now used instead. On Windows, the ``tzdata`` package is required and
50-
installed automatically. (:ghuser:`JoLo90`, :pull:`2757`)
5148

5249

5350
Maintenance

pvlib/location.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@
99
import zoneinfo
1010

1111
import pandas as pd
12+
import pytz
1213
import h5py
1314

1415
from pvlib import solarposition, clearsky, atmosphere, irradiance
1516
from pvlib.tools import _degrees_to_index
17+
from pvlib._deprecation import warn_deprecated
1618

1719

1820
class Location:
@@ -25,7 +27,7 @@ class Location:
2527
2628
* ``tz`` is an IANA time-zone string.
2729
28-
The ``pytz`` attribute was removed. Use ``tz`` property instead.
30+
The ``pytz`` attribute is deprecated. Use ``tz`` property instead.
2931
3032
Location objects support the print method.
3133
@@ -126,6 +128,23 @@ def tz(self, tz_):
126128
"datetime.tzinfo object (including subclasses)"
127129
)
128130

131+
@property
132+
def pytz(self): # pragma: no cover
133+
"""The location's pytz time zone (read only).
134+
135+
.. deprecated::
136+
The ``pytz`` attribute is deprecated. Use the ``tz`` property
137+
instead.
138+
"""
139+
warn_deprecated(
140+
since='0.15.2',
141+
removal='0.17.0',
142+
name='pytz',
143+
obj_type='attribute',
144+
alternative='tz',
145+
)
146+
return pytz.timezone(str(self._zoneinfo))
147+
129148
@classmethod
130149
def from_tmy(cls, tmy_metadata, tmy_data=None, **kwargs):
131150
"""

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ requires-python = ">=3.10"
1313
dependencies = [
1414
'numpy >= 1.21.2',
1515
'pandas >= 1.3.3',
16+
'pytz',
1617
'requests',
1718
'scipy >= 1.7.2',
1819
'h5py',
19-
'tzdata; sys_platform == "win32"',
2020
]
2121
license = "BSD-3-Clause"
2222
classifiers = [

0 commit comments

Comments
 (0)