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.0.0.tar.gz (38.7 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.0.0-py3-none-any.whl (40.5 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for timeweave-1.0.0.tar.gz
Algorithm Hash digest
SHA256 dbf2758ca3514074b879c44a2e0d8a9d2ce6785461304bbc6664f5efffc99a95
MD5 43679a793659309d75827054982dbab8
BLAKE2b-256 b40d6214b2fbc8d3afc59f3265a9ddbd5b3aeb802e8559cf43697ecdd5daf83d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: timeweave-1.0.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.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9b6ed430b97648e9dce5188ff23250e8ee39b817a4c453c2cf7b8d575bcdfa32
MD5 3dcbefc0e39b90941882a38784ffe817
BLAKE2b-256 2e131553df7b89f49fe3886241e238f26f6f231def782b74891f5fcee28ae766

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