types-tzlocal
Typing stubs for tzlocal
What it is and what it does
types-tzlocal is a PEP 561 type stub package that supplies type annotations for the tzlocal library. It allows static type checkers (mypy, pyright, pytype, PyCharm) to understand and validate code that calls tzlocal functions, catching type errors before runtime. The stubs are maintained in the typeshed repository and are tested against mypy 1.6.1, pyright 1.1.332, and pytype 2023.10.17.
This package is specifically versioned for tzlocal 5.1. However, tzlocal has included its own type annotations since version 5.2, making this stub package unnecessary for newer versions. If you are using tzlocal 5.2 or later, you should uninstall types-tzlocal to avoid conflicts and use the built-in stubs instead.
Use it for:
- Enable mypy or pyright to type-check a codebase that imports and uses tzlocal for local timezone detection.
- Provide IDE autocomplete and type hints for tzlocal functions in PyCharm or other type-aware editors.
- Validate timezone-related code in a CI/CD pipeline using static type checking before runtime.
- Ensure type safety when calling tzlocal functions in a strictly typed Python project.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides type stubs for the tzlocal package, enabling static type checkers like mypy, pyright, and pytype to validate code that uses tzlocal for timezone operations.
Yes, but only if you are locked to tzlocal 5.1 or earlier and need type checking support. If you are using tzlocal 5.2 or later, do not install this package—uninstall it if present—because tzlocal now includes its own type stubs. For tzlocal 5.1 users, this is a straightforward, low-friction addition to enable static type checking.
Install
types-tzlocal on PyPI
pip
pip install types-tzlocaluv
uv add types-tzlocalpoetry
poetry add types-tzlocalInstalling types-tzlocal
Before you install
Low install friction with a single lightweight runtime dependency (types-pytz). The package is actively maintained in the typeshed repository, though tzlocal has included its own type annotations since version 5.2, making this package redundant for newer versions.
License in practice
Licensed under Apache-2.0 (permissive), imposing no significant restrictions on use or redistribution in most projects.
Quickstart
pip install types-tzlocal
# Then use with mypy or pyright to type-check code importing tzlocal
import tzlocal
tz = tzlocal.get_localzone()
Only useful if you are using tzlocal version 5.1 or earlier; tzlocal 5.2+ includes its own type stubs and this package should be uninstalled to avoid conflicts.
Verify before relying
- Whether types-pytz is a required runtime dependency or only needed for stub completeness.
- Compatibility with type checkers released after pyright 1.1.332 and mypy 1.6.1.
- Whether this package remains actively maintained given the note that tzlocal 5.2+ includes built-in stubs.
Package facts
| License | Apache-2.0 license (permissive) |
| Python support | supports the current Python release (>=3.7) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — types-pytz |
| Maintenance | actively maintained — 1,025 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 2,448,155/month — #3,060 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: types_tzlocal-5.1.0.1-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
types-PillowProvides type stubs for Pillow, enabling static…
permissive · top 5,000 on PyPI
types-DateTimeRangeProvides type stubs for the DateTimeRange…
permissive · top 15,000 on PyPI
types-caldavProvides type stubs for caldav, enabling static…
permissive · top 15,000 on PyPI
types-futuresProvides type stubs for the futures package,…
permissive · top 15,000 on PyPI
types-babelProvides type stubs for the babel package,…
permissive · top 15,000 on PyPI
types-emojiProvides type stubs for the emoji package,…
permissive · top 15,000 on PyPI
types-redisProvides type stubs for the redis package,…
permissive · top 1,000 on PyPI
types-chardetProvides type stubs for character encoding…
permissive · top 5,000 on PyPI
types-termcolorProvides type stubs for the termcolor package,…
permissive · top 15,000 on PyPI
types-python-slugifyProvides type stubs for the python-slugify…
permissive · top 5,000 on PyPI