pytzdata is a Python library that provides access to the IANA/Olson timezone database files. It packages a snapshot of this database, allowing applications to retrieve raw timezone definitions. The current version, 2020.1, was released in July 2020. The project does not appear to follow a regular release cadence and is effectively in maintenance mode, largely superseded by the standard library `zoneinfo` module in Python 3.9+ and the `tzdata` package.
pip install pytzdataVerified import paths — ran on the pinned version, not inferred.
Demonstrates how to retrieve the file path for a timezone or access its raw content using `tz_path` and `tz_file`.
For Python 3.9+, use `from zoneinfo import ZoneInfo` and `pip install tzdata`. For older Python versions requiring external timezone libraries, consider `dateutil.tz` or pinning `pytzdata` and `pytz` to known working versions while being aware of potential data staleness.
To create timezone-aware `datetime` objects, use `pytz.timezone('Europe/Paris')` (for `pytz`) or `ZoneInfo('Europe/Paris')` (for `zoneinfo` with Python 3.9+ and `tzdata` installed). Do not attempt to use `pytzdata` imports directly as `tzinfo` objects.Ensure your timezone data is current. If using Python 3.9+, prefer `zoneinfo` with `tzdata`, which is updated more frequently. If you must use `pytzdata`, be aware that recent changes to daylight saving rules or geopolitical timezone changes might not be reflected.
pip install pytzdata
To create timezone-aware `datetime` objects, use `pytz` (`import pytz; tz = pytz.timezone('Europe/London')`) or the standard library `zoneinfo` (`from zoneinfo import ZoneInfo; tz = ZoneInfo('Europe/London')`).Verify the correct spelling of the timezone name (e.g., 'Europe/London'). You can use `pytzdata.get_all_timezones()` to list all available timezone names.
To access `pytzdata` functionality, import the main `pytzdata` module directly (`import pytzdata`). If you intended to use the separate `tzdata` package, ensure it is installed (`pip install tzdata`) and import it as `import tzdata`.
No dependency data recorded yet.