Exemple
tzdata 2026.3: IANA_VERSION
Échantillon vérifié pour pypi tzdata 2026.3: IANA_VERSION. Le contrat s'est exécuté sur python 3.12 · linux alpine/x64 · docker et a réussi.
sha256:274c3c38fb247527a558c577893b2f7e04d129f7e4cc31958b39510c28c7da79
Ce réseau offre une seule chose : un échantillon qui compile. Il l'a exécuté dans un bac à sable et conservé le reçu signé. Il ne note rien et ne garantit rien : si le même code compile chez vous, il ne l'a pas mesuré.
Combien de clés de signature distinctes ont déposé un reçu de contrat réussi. Une seule, c'est l'auteur ; plus d'une signifie que quelqu'un d'autre l'a compilé aussi. Une clé est auto-générée sans identité enregistrée derrière, donc on compte des clés, pas des personnes.
MIT-0
Preuves d'exécution
L'environnement déclaré et les exécutions signées sont séparés, pour que vous voyiez exactement ce que cet échantillon a exécuté et où.
- Base de preuve
- Contrat signé réussi
- Reçus de vérification
- 1
- Clés de signature qui l’ont compilé
- 1
Environnement déclaré
python linux 24 · ubuntu · glibc 2.39 x64 python python pip
Environnements des exécutions de vérification
| Environnement | Contrat | Étapes | Exécution |
|---|---|---|---|
| python 3.12 · linux alpine/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · python@1python:3.12-alpine@sha256:d09d15e60962… |
2026-08-27 |
Cas
HOW- Objectif
- verify pkg:pypi/tzdata@2026.3
- Paquets
- Symboles
-
- tzdata.IANA_VERSION
- Environnement
- python
- Créé
- 2026-08-27T22:28:50Z
Contrat
- tzdata.IANA_VERSION exposes the IANA database release identifier matching format YYYY[a-z] and __version__ matching the package version 2026.3.
- tzdata provides the bundled zones resource file containing valid IANA timezone identifier names including UTC, America/New_York, Europe/London, and Asia/Tokyo.
- tzdata.zoneinfo package namespace contains compiled binary zoneinfo data files for time zone definitions.
- zoneinfo.ZoneInfo resolves timezone data provided by tzdata and computes correct UTC offsets for America/New_York (-05:00 in winter) and Asia/Tokyo (+09:00).
- zoneinfo.ZoneInfo raises ZoneInfoNotFoundError or KeyError when queried with an invalid timezone key.
Fichiers
- NOTES.md
- PROMPT.md
- csx.json
- requirements.txt
- spec.json
- test/contract.py
Code source
# tzdata IANA Time Zone Database for Python
This sample pins `tzdata` 2026.3 and verifies `tzdata.IANA_VERSION` and time zone data resources for Python's standard `zoneinfo` module.
The contract verifies:
- `tzdata.IANA_VERSION` exposes the IANA database release string (e.g. `'2026c'`) and `tzdata.__version__` matches `'2026.3'`.
- `tzdata` provides the `zones` resource file listing all valid IANA time zone identifiers.
- `tzdata.zoneinfo` package namespace contains compiled binary zoneinfo data files for major time zones.
- `zoneinfo.ZoneInfo` resolves timezone names and computes accurate UTC offsets.
- Invalid timezone names raise `ZoneInfoNotFoundError` or `KeyError`.
Clean-room public code sample — generation instructions
Write a brand-new, minimal, self-contained code sample in this clean-room directory.
Do not copy, paraphrase, or reference any existing project source. Work only from this spec.
A csx.json manifest scaffold already exists. Do not recreate it from memory. Preserve its case.goal, packages and symbols; fill its empty case.contract with exact assertions and correct its environment, commands and verifierAdapter for the files you generate.
Goal: verify pkg:pypi/tzdata@2026.3
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:pypi/tzdata@2026.3
Demonstrate these symbols/APIs:
- tzdata.IANA_VERSION
Rules:
- One focused purpose; the smallest project that proves the goal.
- Include a contract test (test/contract.*) that runs OFFLINE and exits 0 exactly when the goal behavior works.
- Pin every dependency with a lockfile so resolution is reproducible.
- No secrets, credentials, or tokens. No real URLs (only example.com or localhost). No absolute paths.
- No personal names, emails, company names, or project identifiers of any kind.
- No binaries and no generated output (node_modules, dist, target, venv, .git, .env).
- Keep it under 200 files and 256KB packed.
{"case":{"caseId":"case:sha256:645fed2b7f68fefc993be54776a3ffe4743e67b1f0515b8bca6735af5757e9cc","contract":["tzdata.IANA_VERSION exposes the IANA database release identifier matching format YYYY[a-z] and __version__ matching the package version 2026.3.","tzdata provides the bundled zones resource file containing valid IANA timezone identifier names including UTC, America/New_York, Europe/London, and Asia/Tokyo.","tzdata.zoneinfo package namespace contains compiled binary zoneinfo data files for time zone definitions.","zoneinfo.ZoneInfo resolves timezone data provided by tzdata and computes correct UTC offsets for America/New_York (-05:00 in winter) and Asia/Tokyo (+09:00).","zoneinfo.ZoneInfo raises ZoneInfoNotFoundError or KeyError when queried with an invalid timezone key."],"goal":"verify pkg:pypi/tzdata@2026.3","kind":"HOW","packages":["pkg:pypi/tzdata@2026.3"],"schemaVersion":1,"symbols":["tzdata.IANA_VERSION"]},"contractCommand":["python","test/contract.py"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"pypi","executionContext":"python","language":"python","libc":"glibc","libcVersion":"2.39","os":"linux","osVersionBucket":"24","packageManager":"pip","runtime":"python","schemaVersion":1},"license":"MIT-0","packages":["pkg:pypi/tzdata@2026.3"],"schemaVersion":1,"subject":"pkg:pypi/tzdata@2026.3","symbols":["tzdata.IANA_VERSION"],"verifierAdapter":"python@1"}
tzdata==2026.3
{
"schemaVersion": 1,
"goal": "verify pkg:pypi/tzdata@2026.3",
"kind": "HOW",
"packages": [
"pkg:pypi/tzdata@2026.3"
],
"symbols": [
"tzdata.IANA_VERSION"
]
}
import datetime
import importlib.resources
import re
import zoneinfo
import tzdata
# 1. Verify IANA_VERSION and __version__ attributes
assert hasattr(tzdata, "IANA_VERSION"), "tzdata must define IANA_VERSION"
assert isinstance(tzdata.IANA_VERSION, str), f"Expected str for IANA_VERSION, got {type(tzdata.IANA_VERSION)}"
assert re.match(r"^\d{4}[a-z]$", tzdata.IANA_VERSION), f"Unexpected IANA_VERSION format: {tzdata.IANA_VERSION}"
assert hasattr(tzdata, "__version__"), "tzdata must define __version__"
assert tzdata.__version__ == "2026.3", f"Expected __version__ 2026.3, got {tzdata.__version__}"
# 2. Verify tzdata package resource: zones listing file
zones_resource = importlib.resources.files("tzdata").joinpath("zones")
assert zones_resource.is_file(), "tzdata/zones resource file must exist and be a file"
zones_content = zones_resource.read_text(encoding="utf-8")
zones_list = [line.strip() for line in zones_content.splitlines() if line.strip()]
assert len(zones_list) >= 500, f"Expected at least 500 timezone entries, got {len(zones_list)}"
assert "UTC" in zones_list, "UTC must be listed in zones"
assert "America/New_York" in zones_list, "America/New_York must be listed in zones"
assert "Europe/London" in zones_list, "Europe/London must be listed in zones"
assert "Asia/Tokyo" in zones_list, "Asia/Tokyo must be listed in zones"
# 3. Verify tzdata.zoneinfo binary timezone data files exist
zi_resource = importlib.resources.files("tzdata.zoneinfo")
assert zi_resource.joinpath("UTC").is_file(), "tzdata.zoneinfo UTC file must exist"
assert zi_resource.joinpath("America", "New_York").is_file(), "tzdata.zoneinfo America/New_York file must exist"
assert zi_resource.joinpath("Europe", "London").is_file(), "tzdata.zoneinfo Europe/London file must exist"
assert zi_resource.joinpath("Asia", "Tokyo").is_file(), "tzdata.zoneinfo Asia/Tokyo file must exist"
# 4. Verify standard library zoneinfo.ZoneInfo resolution using tzdata
zi_ny = zoneinfo.ZoneInfo("America/New_York")
assert zi_ny.key == "America/New_York"
dt_utc_jan = datetime.datetime(2026, 1, 15, 12, 0, 0, tzinfo=datetime.timezone.utc)
dt_ny_jan = dt_utc_jan.astimezone(zi_ny)
assert dt_ny_jan.utcoffset() == datetime.timedelta(hours=-5), f"Expected -05:00 UTC offset, got {dt_ny_jan.utcoffset()}"
zi_tokyo = zoneinfo.ZoneInfo("Asia/Tokyo")
dt_tokyo = dt_utc_jan.astimezone(zi_tokyo)
assert dt_tokyo.utcoffset() == datetime.timedelta(hours=9), f"Expected +09:00 UTC offset, got {dt_tokyo.utcoffset()}"
# 5. Verify non-existent timezone key raises ZoneInfoNotFoundError
try:
zoneinfo.ZoneInfo("Invalid/NonExistent_Zone_12345")
raise AssertionError("Expected ZoneInfoNotFoundError for non-existent timezone key")
except (zoneinfo.ZoneInfoNotFoundError, KeyError):
pass
print("CONTRACT PASS: pkg:pypi/tzdata@2026.3 verified offline")
Seeder d'origine
anonyme