pytz
World timezone definitions, modern and historical
Install
pytz on PyPI
pip
pip install pytzuv
uv add pytzpoetry
poetry add pytzPackage facts
| License | MIT (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 19 days since the last release |
| Last repo commit | |
| First released | |
| Popularity | one of the 100 most-downloaded packages on PyPI (30-day window, as of 2026-08-13) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-13) |
Evidence: pytz-2026.3.post1-py2.py3-none-any.whl
Keywords: timezone, tzinfo, datetime, olson, time
About pytz
from the package's own PyPI description — quoted content, verbatim
pytz - World Timezone Definitions for Python
:Author: Stuart Bishop <stuart@stuartbishop.net>
Introduction ~~~~~~~~~~~~
pytz brings the Olson tz database into Python. This library allows
accurate and cross platform timezone calculations using Python 2.4
or higher. It also solves the issue of ambiguous times at the end
of daylight saving time, which you can read more about in the Python
Library Reference (datetime.tzinfo).
Almost all of the Olson timezones are supported.
.. note::
Projects using Python 3.9 or later should use the standard library
`zoneinfo <https://docs.python.org/3/library/zoneinfo.html>`_ module with
time zone database updates from `tzdata <https://pypi.org/project/tzdata/>`_ package.
pytz offers no advantages beyond backwards compatibility with
code written for earlier versions of Python.
.. note::
This library differs from the documented Python API for
tzinfo implementations; if you want to create local wallclock
times you need to use the ``localize()`` method documented in this
document. In addition, if you perform date arithmetic on local
times that cross DST...
Read as markdown · JSON record · Source repository · Homepage
AI interpretation — verify before relying
AI-generated interpretation of the package facts above; every digit, version, license, or vulnerability id it cites is grounded in the facts already shown on this page
pytz brings the Olson timezone database into Python, enabling accurate cross-platform timezone calculations and handling of daylight saving time transitions using the datetime module.
Installation is straightforward with low friction—pytz is a pure-Python wheel with no runtime dependencies. The package is actively maintained with a recent release (19 days old) and steady repository activity.
pytz is licensed under MIT, a permissive license that allows commercial and private use with minimal restrictions, making it suitable for most projects.
Usage
pip install pytz
from datetime import datetime
from pytz import timezone
eastern = timezone('US/Eastern')
loc_dt = eastern.localize(datetime(2002, 10, 27, 6, 0, 0))
print(loc_dt.strftime('%Y-%m-%d %H:%M:%S %Z%z'))
For Python 3.9+, the standard library zoneinfo module with tzdata package is preferred; pytz is primarily for backward compatibility with earlier Python versions.
Verdict: pytz is a mature, actively maintained timezone library with no known vulnerabilities and permissive licensing. However, the package documentation explicitly recommends Python 3.9+ users adopt the standard library zoneinfo module instead, reserving pytz mainly for legacy codebases. For older Python versions or existing pytz-dependent projects, it remains a reliable choice.
Needs verification
- Whether the package's non-standard tzinfo API (requiring localize() and normalize() methods) creates migration friction for users transitioning to zoneinfo.
- Current adoption trends among new projects versus legacy maintenance scenarios.
Similar packages
permissive · top 1,000 on PyPI
arrowpermissive · top 1,000 on PyPI
croniterpermissive · top 1,000 on PyPI
parsedatetimepermissive · top 1,000 on PyPI
pendulumpermissive · top 1,000 on PyPI
tzlocalpermissive · top 1,000 on PyPI
simple-salesforcepermissive · top 1,000 on PyPI
annotated-typespermissive · top 100 on PyPI
python-dateutilpermissive · top 100 on PyPI
tzdatapermissive · top 100 on PyPI