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.6.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.6.0-py3-none-any.whl (40.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: timeweave-1.6.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.6.0.tar.gz
Algorithm Hash digest
SHA256 f2c50ffea85f24d8b251d62e695c90eff083df75dbbd574a360c1f3901c8d15e
MD5 fc4ef4bbdd011eab83f40efa3aa62132
BLAKE2b-256 0b13892e9af633cc50095cc61a231cf779512af7ec0c1eb17af2f7fd9a34e55b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: timeweave-1.6.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.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3d63cd5f076f58e64d18710270bb6b35ce69d826dcb0f6d07fb3f9c54df5af2c
MD5 f7416187320c60a97a1530031c406410
BLAKE2b-256 0166c9a3e5d20f4a39a9ddc3cf56be38f2d8787204831708299545159e9089ff

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