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. 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.9.0.tar.gz (39.3 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.9.0-py3-none-any.whl (41.0 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for timeweave-1.9.0.tar.gz
Algorithm Hash digest
SHA256 db2bcb20e29a82f735c6c97c34603eea67690de024d848c8ac3043e04cc3b1bd
MD5 244b6ec20cb1b9cf6af081f3efcf6364
BLAKE2b-256 314de71758f27718faa959848817f95292af240990c776512cd94b20d073081f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: timeweave-1.9.0-py3-none-any.whl
  • Upload date:
  • Size: 41.0 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.9.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cb99aa4856280f1ccc1369b3a96e2ea165afdf5fd26d1036fcc9c5cb5ee19028
MD5 830f37f5073dbbd061821c540d6876b0
BLAKE2b-256 2edb26941a6bf59753c995880da52b0b4e8c7a386bb79fd12277ba4b05127192

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