skillfed

types-tzlocal

Typing stubs for tzlocal

types-tzlocal v5.1.0.1 2.4M downloads/30d#3,060 on PyPI5,108
Permissive license Apache-2.0 license Active released

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

uv

uv add types-tzlocal

poetry

poetry add types-tzlocal

Installing 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

License :: OSI Approved :: Apache Software LicenseProgramming Language :: Python :: 3Typing :: Stubs Only

Tags

type stubs tzlocalmypy tzlocal typingpyright timezone stubsstatic type checking timezonePEP 561 type stubstzlocal type annotations
type-stubsstatic-analysis

More Software Development packages