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.8.0.tar.gz (39.2 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.8.0-py3-none-any.whl (40.9 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for timeweave-1.8.0.tar.gz
Algorithm Hash digest
SHA256 a182a842696bb1053036c055c5e242d13c60e2c69dbf9dbd8a9586f51734f385
MD5 86472c52c251686398903a50c11e3912
BLAKE2b-256 1e0184f4111a78058bc46c396d57e4f3790af31b61cd6b8823a142a5b78f578f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: timeweave-1.8.0-py3-none-any.whl
  • Upload date:
  • Size: 40.9 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.8.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2be92981bed90969f77ac059b4033ae2cf3df55b687043191368e9733f73003f
MD5 de0a826b5ca9a5e75e3fccd04da72532
BLAKE2b-256 686c369f52a313945b40437a164b59b7067711d6f41d4234e389ecc3a65ec0f2

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