A simple timezone lookup by zip code
Project description
zip2tz
A simple Python library to look up timezones by US zip code.
Installation
pip install zip2tz
Or with uv:
uv add zip2tz
Usage
import zip2tz
# Get timezone for a zip code
tz = zip2tz.timezone("90210")
print(tz) # America/Los_Angeles
# Returns None if zip code not found
tz = zip2tz.timezone("00000")
print(tz) # None
API
timezone(zipcode: str) -> str | None
Returns the IANA timezone string (e.g., "America/New_York") for the given zip code, or None if the zip code is not found.
Development
This project uses uv for dependency management.
# Clone the repo
git clone https://github.com/yourusername/zip2tz.git
cd zip2tz
# Build
uv build
# Run tests
uv venv .venv-test
uv pip install dist/zip2tz-*.whl -p .venv-test
.venv-test/Scripts/python tests/smoke_test.py # Windows
# .venv-test/bin/python tests/smoke_test.py # Linux/Mac
License
MIT License - see LICENSE for details.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file zip2tz-0.1.0.tar.gz.
File metadata
- Download URL: zip2tz-0.1.0.tar.gz
- Upload date:
- Size: 102.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.22 {"installer":{"name":"uv","version":"0.9.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6c66bdd338e56347e88aaa5293046b05e7c8fec3b04e3267d740e1475a4cdb97
|
|
| MD5 |
d6d49df88634320e3af3603444aecdf2
|
|
| BLAKE2b-256 |
11e9aa8e8fd26d3991f82f7b29867944dfd659bb7b6d54aa60f423f092ee4f8b
|
File details
Details for the file zip2tz-0.1.0-py3-none-any.whl.
File metadata
- Download URL: zip2tz-0.1.0-py3-none-any.whl
- Upload date:
- Size: 101.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.22 {"installer":{"name":"uv","version":"0.9.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8d37be96809330b5197fe2d78b76a69fb9c1d64d9bbee124f640d07432b16573
|
|
| MD5 |
a1ab0f457212fe39464dbaed1ce01f52
|
|
| BLAKE2b-256 |
d6b01f92cf7649fb45d8c1b58270fa996e2bda89a6c40166238d1ba50d077e71
|