Skip to main content
Quarantined

This project has been quarantined by PyPI admins. It cannot be installed or modified until a security review is complete.

timeweave

Timezone detection, conversion, and a self-maintaining IANA rule cache. Zero runtime dependencies. Python 3.9+.

Install

pip install timeweave

Layers

Module Role
timeweave.tzkit Detect, convert, parse, list zones (read path)
timeweave.updater Fetch + SHA-256 verify + cache the rules DB
timeweave.compiler Fetch + verify + zic-compile tz source into a zoneinfo tree

Library use

import timeweave

info = timeweave.detect_timezone()
print(info["timezone"], info["utc_offset"], info["dst_active"])

result = timeweave.convert_timezone(
    "2024-03-10 02:30", ["UTC", "Asia/Tokyo"], from_zone="America/New_York"
)
print(result["instant_utc"], result["local_time_kind"])

parsed = timeweave.parse_datetime("Sun, 10 Mar 2024 07:30:00 +0000")

CLI

tzkit detect --use-ip
tzkit convert '2024-03-10 02:30' --from America/New_York --to UTC --to Asia/Tokyo
tzkit parse 'Sun, 10 Mar 2024 07:30:00 +0000'
tzkit list Europe --transitions --sort offset

tz-update check --json
tz-compile refresh --force
tz-compile status

DST policy

Wall-clock times that fall in a DST gap or fold are classified, never guessed silently:

  • --ambiguous earliest|latest|raise — repeated wall times (fold)
  • --nonexistent shift_forward|shift_backward|raise — skipped wall times (gap)

raise exits 6 so CI catches the case.

Auto-update

detect_timezone() and convert_timezone() start a non-blocking daemon-thread update check, at most once per 24h, gated by a marker file. Failures are logged and swallowed; the caller's result is never affected.

Disable it:

Variable Effect
TIMEWEAVE_NO_AUTO_UPDATE=1 Disable the on-use check only
TIMEWEAVE_OFFLINE=1 Disable all outbound network from the package
TIMEWEAVE_NO_NETWORK=1 Same as OFFLINE
TIMEWEAVE_AUTO_INTERVAL Seconds between checks (default 86400)

Environment

Variable Purpose
TIMEWEAVE_SRC_URL Source endpoint (compiler)
TIMEWEAVE_CHECKSUM_URL Published SHA-256 (default <url>.sha256)
TIMEWEAVE_SIGNATURE_URL + TIMEWEAVE_GPG_KEYRING Authenticity verification
TIMEWEAVE_ZIC_PATH Absolute zic path (trusted config only)
TIMEWEAVE_CACHE_DIR Cache directory
TZDIR Compiled zoneinfo tree; prepended to zoneinfo.TZPATH on import
SSL_CERT_FILE / REQUESTS_CA_BUNDLE Custom CA bundle
HTTP_PROXY / HTTPS_PROXY / NO_PROXY Standard proxy settings

Security notes

  • SHA-256 proves integrity, not authenticity. If the same host serves the payload and the checksum, it controls both. Set TIMEWEAVE_SIGNATURE_URL and TIMEWEAVE_GPG_KEYRING against a trusted key for real authenticity.
  • The compiler targets an app-owned directory by default. Writing into /usr/share/zoneinfo requires --system, needs root, and affects every process on the host. Prefer your OS's signed tzdata package for the system tree; use this module for isolated, air-gapped, or version-pinned caches.
  • Archive members and Zone/Link names are validated before zic runs, and compiler output is re-checked for containment afterwards.
  • The zic path is a fixed absolute constant, validated executable, and is never read from a network response.

License

MIT

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

timeweave-1.1.0.tar.gz (38.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

timeweave-1.1.0-py3-none-any.whl (40.5 kB view details)

Uploaded Python 3

File details

Details for the file timeweave-1.1.0.tar.gz.

File metadata

  • Download URL: timeweave-1.1.0.tar.gz
  • Upload date:
  • Size: 38.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.0

File hashes

Hashes for timeweave-1.1.0.tar.gz
Algorithm Hash digest
SHA256 3dea14ddced71c495f1eac463e52ce8f2ba0cd2d50fb59f9e5e4d21dbb844e75
MD5 e18d29db54f209b553ef8718523a08ab
BLAKE2b-256 fadf79641cd130e7382cbfbe1ff0f1e98ba62cf5656c79ddc66bc73ba292d974

See more details on using hashes here.

File details

Details for the file timeweave-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: timeweave-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 40.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.0

File hashes

Hashes for timeweave-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c805d83adf498c6709049ca8db4a09aabec5ff395404149b47887706487d855b
MD5 77dab2e061a1423fecd4fab0decb692e
BLAKE2b-256 0caa6b797a1d7dacd37030e3068c8a2daf88cea5d3500d0610cf2cb88ce9863d

See more details on using hashes here.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page