pytz-deprecation-shim
Shims to make deprecation of pytz easier
What it is and what it does
pytz_deprecation_shim provides timezone objects that bridge the gap between pytz's non-standard interface and the modern PEP 495 standard. It wraps timezone data to accept both the old pytz methods (localize, normalize) and the standard datetime fold attribute, emitting deprecation warnings when legacy methods are called. This allows library maintainers to remove their pytz dependency without immediately breaking code that still uses pytz-style timezone handling.
The package is explicitly designed as a temporary migration tool, not a long-term solution. It depends on python-dateutil, tzdata, and backports.zoneinfo to provide the underlying timezone data and compatibility layer. However, the project has been abandoned since June 2020 with no updates since March 2022, making it risky for new projects or those requiring ongoing support.
Use it for:
- Migrate a library away from pytz while maintaining backward compatibility with users still calling localize() and normalize().
- Provide a deprecation path for applications that have embedded pytz zones in their public API.
- Test datetime arithmetic across daylight saving time transitions using standard PEP 495 semantics instead of pytz's non-standard behavior.
- Gradually transition codebases from pytz to zoneinfo by using shim zones that work with both interfaces.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides drop-in timezone shims that support both the standard PEP 495 datetime interface and pytz's legacy localize/normalize methods, allowing libraries to deprecate pytz gradually.
No, except in narrow circumstances. The package is abandoned and has not been updated in over four years. While it has low install friction and a permissive license, its core purpose—helping libraries deprecate pytz—is now better served by directly migrating to zoneinfo (Python 3.9+) or backports.zoneinfo (earlier versions). Use this only if you are actively maintaining a library that has already exposed pytz zones to users and need a temporary bridge; for new projects, migrate directly to zoneinfo.
Install
pytz-deprecation-shim on PyPI
pip
pip install pytz-deprecation-shimuv
uv add pytz-deprecation-shimpoetry
poetry add pytz-deprecation-shimInstalling pytz-deprecation-shim
Before you install
Low install friction with three stable runtime dependencies. However, the package is abandoned as of March 2022 with no releases since June 2020, making it unsuitable for new projects or long-term maintenance.
License in practice
Apache-2.0 is permissive and poses no restriction on use or redistribution, making licensing a non-issue for adoption.
Quickstart
pip install pytz-deprecation-shim
import pytz_deprecation_shim as pds
from datetime import datetime
LA = pds.timezone("America/Los_Angeles")
dt = datetime(2020, 10, 31, 12, tzinfo=LA)
print(dt) # 2020-10-31 12:00:00-07:00
Requires Python 2.7 or 3.6+; the package is abandoned and receives no maintenance.
Verify before relying
- Whether the package still works correctly with current versions of python-dateutil, tzdata, and backports.zoneinfo.
- Whether the shim's behavior remains compatible with modern zoneinfo implementations across all supported Python versions.
Package facts
| License | Apache-2.0 (permissive) |
| Python support | supports the current Python release (!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,>=2.7) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 3 — python-dateutil, tzdata, backports.zoneinfo |
| Maintenance | abandoned — 2,249 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 3,046,922/month — #2,775 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pytz_deprecation_shim-0.1.0.post0-py2.py3-none-any.whl
Tags
More Software Development packages
Provides backported and experimental type hints…
permissive · top 100 on PyPI
numpyNumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
distlibDistlib provides low-level packaging utilities…
permissive · top 1,000 on PyPI
pytzpytz brings the Olson timezone database into…
permissive · top 100 on PyPI
tzlocalReturns the IANA timezone name and tzinfo…
permissive · top 1,000 on PyPI
tzdataProvides IANA time zone data as a Python…
permissive · top 100 on PyPI
backports.zoneinfoProvides IANA time zone support for Python…
permissive · top 5,000 on PyPI
django-timezone-fieldProvides Django database, form, and REST…
permissive · top 5,000 on PyPI
tzfpyConverts geographic coordinates…
permissive · top 5,000 on PyPI
DateTimeProvides a DateTime data type for working with…
unclear · top 5,000 on PyPI
iso8601Parses ISO 8601 date strings (e.g.…
permissive · top 5,000 on PyPI
wheneverWhenever provides type-safe, DST-aware datetime…
permissive · top 5,000 on PyPI