python-tzlocal
Port variant v14
Summary Tzinfo object for the local timezone (3.14)
Package version 5.3.1
Homepage https://pypi.org/project/tzlocal/
Keywords python
Maintainer Python Automaton
License Not yet specified
Other variants v13
Ravenports Buildsheet | History
Ravensource Port Directory | History
Last modified 05 DEC 2025, 06:39:06 UTC
Port created 05 DEC 2025, 06:39:06 UTC
Subpackage Descriptions
single tzlocal ======= API CHANGE! ----------- With version 3.0 of tzlocal, tzlocal no longer returned `pytz` objects, but `zoneinfo` objects, which has a different API. Since 4.0, it now restored partial compatibility for `pytz` users through Paul Ganssle's `pytz_deprecation_shim`. tzlocal 4.0 also adds an official function `get_localzone_name()` to get only the timezone name, instead of a timezone object. On unix, it can raise an error if you don't have a timezone name configured, where `get_localzone()` will succeed, so only use that if you need the timezone name. 4.0 also adds way more information on what is going wrong in your configuration when the configuration files are unclear or contradictory. Version 5.0 removes the `pytz_deprecation_shim`, and now only returns `zoneinfo` objects, like verion 3.0 did. If you need `pytz` objects, you have to stay on version 4.0. If there are bugs in version 4.0, I will release updates, but there will be no further functional changes on the 4.x branch. Info ---- This Python module returns the [IANA time zone name ] for your local time zone or a tzinfo object with the local timezone information, under Unix and Windows. This module attempts to fix a glaring hole in the pytz and zoneinfo modules, that there is no way to get the local timezone information, unless you know the zoneinfo name, and under several Linux distros that's hard or impossible to figure out. With tzlocal you only need to call ``get_localzone() and you will get a tzinfo`` object with the local time zone info. On some Unices you will still not get to know what the timezone name is, but you don't need that when you have the tzinfo file. However, if the timezone name is readily available it will be used. What it's not for ----------------- It's not for converting the current time between UTC and your local time. There are other, simpler ways of doing this. This is if you need to know things like the name of the time zone, or if you need to be able to convert between your time zone and another time zone for times that are in the future or in the past. For current time conversions to and from UTC, look in the Python time module. Supported systems ----------------- These are the systems that are in theory supported: * Windows 2000 and later * Any unix-like system with a ``/etc/localtime or /usr/local/etc/localtime`` If you have one of the above systems and it does not work, it's a bug. Please report it. Please note that if you are getting a time zone called local, this is not a bug, it's actually the main feature of tzlocal, that even if your system does NOT have a configuration file with the zoneinfo name of your time zone, it will still work. You can also use tzlocal to get the name of your local timezone, but only if your system is configured to make that possible. tzlocal looks for the timezone name in ``/etc/timezone``, ``/var/db/zoneinfo``, ``/etc/sysconfig/clock and /etc/conf.d/clock``. If your ``/etc/localtime`` is a symlink it can also extract the name from that symlink. If you need the name of your local time zone, then please make sure your system is properly configured to allow that. If your unix system doesn't have a timezone configured, tzlocal will default to UTC. Notes on Docker --------------- It turns out that Docker images frequently have broken timezone setups. This usually results in a warning that the configuration is wrong, or that the timezone offset doesn't match the found timezone.
Configuration Switches (platform-specific settings discarded)
PY313 OFF Build using Python 3.13 PY314 ON Build using Python 3.14
Package Dependencies by Type
Build (only) python314:dev:std
python-pip:single:v14
autoselect-python:single:std
Build and Runtime python314:primary:std
Download groups
main mirror://PYPIWHL/c2/14/e2a54fabd4f08cd7af1c07030603c3356b74da07f7cc056e600436edfa17
Distribution File Information
eb1a66c3ef5847adf7a834f1be0800581b683b5608e74f86ecbcef8ab91bb85d 18026 python-src/tzlocal-5.3.1-py3-none-any.whl
Ports that require python-tzlocal:v14
python-celery:v14 Distributed Task Queue (3.14)