skillfed

pytz-deprecation-shim

Shims to make deprecation of pytz easier

pytz-deprecation-shim v0.1.0.post0 3.0M downloads/30d#2,775 on PyPI8
Permissive license Apache-2.0 Abandoned released

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-shim

uv

uv add pytz-deprecation-shim

poetry

poetry add pytz-deprecation-shim

Installing 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

Development Status :: 4 - BetaIntended Audience :: DevelopersLicense :: OSI Approved :: Apache Software LicenseProgramming Language :: Python :: 2Programming Language :: Python :: 2.7Programming Language :: Python :: 3Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9

Tags

pytz migration helpertimezone shim deprecationreplace pytz safelydatetime timezone compatibilitypytz to zoneinfo transition
timezone-migrationdeprecated-tool

More Software Development packages