Exemplo
pooch 1.9.0: pooch
Amostra verificada para pypi pooch 1.9.0: pooch. O contrato rodou em python 3.12 · linux debian/x64 · docker e passou: pooch.__version__ exposes a valid…
sha256:4670ba3b3ab4820df3fb0da3f7a30fee8e4470e6b44dde8d21769bb3198f83cf
Esta rede oferece uma coisa: uma amostra que compila. Ela a executou em um sandbox e guardou o recibo assinado. Não classifica nem garante nada — se o mesmo código compila onde você está, ela não mediu.
Quantas chaves de assinatura distintas enviaram um recibo de contrato aprovado. Uma é só o autor; mais de uma significa que outra pessoa também o compilou. Uma chave é gerada por conta própria e não tem identidade registrada por trás, então conta chaves, não pessoas.
MIT-0
Evidência de execução
O ambiente declarado e as execuções assinadas ficam separados, para você ver exatamente o que esta amostra executou e onde.
- Base da evidência
- Contrato assinado aprovado
- Recibos de verificação
- 1
- Chaves de assinatura que o compilaram
- 1
Ambiente declarado
python 3.12 linux 24 · ubuntu · glibc 2.39 x64 python 3.12 python pip
Ambientes das execuções de verificação
| Ambiente | Contrato | Etapas | Execução |
|---|---|---|---|
| python 3.12 · linux debian/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · python@1python:3.12-slim@sha256:09f7da3bc104… |
2026-09-05 |
Caso
HOW- Objetivo
- verify pooch in pkg:pypi/pooch@1.9.0
- Pacotes
- Símbolos
-
- pooch
- Ambiente
- python 3.12
- Criado
- 2026-09-05T18:42:56Z
Contrato
- pooch.__version__ exposes a valid release version string matching the pinned package version.
- pooch.os_cache returns an operating-system specific cache directory as a pathlib.Path containing the provided application namespace.
- pooch.file_hash computes cryptographic checksums for local files using sha256 by default and supports alternative algorithms including md5.
- pooch.check_version validates PEP440 version strings and replaces unreleased development version strings with the designated fallback string.
- pooch.check_version raises packaging.version.InvalidVersion when given an invalid version string.
- pooch.get_logger returns the default pooch Logger instance and supports configuring logging levels.
- pooch.HTTPDownloader initializes with configurable download parameters including chunk size, progress bar display, and custom request headers.
- pooch.DOIDownloader initializes with configurable DOI download options including chunk size and request timeout.
Arquivos
- NOTES.md
- PROMPT.md
- csx.json
- pyproject.toml
- requirements.txt
- spec.json
- test/contract.py
Código-fonte
# pooch Package Verification
This sample pins `pooch` 1.9.0 and verifies core module functions and classes.
The contract verifies:
- `pooch.__version__` exposes a valid release version string matching the pinned package version.
- `pooch.os_cache` returns an operating-system specific cache directory as a `pathlib.Path` containing the provided application namespace.
- `pooch.file_hash` computes cryptographic checksums for local files using sha256 by default and supports alternative algorithms including md5.
- `pooch.check_version` validates PEP440 version strings and replaces unreleased development version strings with the designated fallback string.
- `pooch.check_version` raises `packaging.version.InvalidVersion` when given an invalid version string.
- `pooch.get_logger` returns the default pooch `Logger` instance and supports configuring logging levels.
- `pooch.HTTPDownloader` initializes with configurable download parameters including chunk size, progress bar display, and custom request headers.
- `pooch.DOIDownloader` initializes with configurable DOI download options including chunk size and request timeout.
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 pooch in pkg:pypi/pooch@1.9.0
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:pypi/pooch@1.9.0
Demonstrate these symbols/APIs:
- pooch
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:49db6dbea0cb0454336ef0746a19c90232f23ddc700f018bf5f845e0e71a82ab","contract":["pooch.__version__ exposes a valid release version string matching the pinned package version.","pooch.os_cache returns an operating-system specific cache directory as a pathlib.Path containing the provided application namespace.","pooch.file_hash computes cryptographic checksums for local files using sha256 by default and supports alternative algorithms including md5.","pooch.check_version validates PEP440 version strings and replaces unreleased development version strings with the designated fallback string.","pooch.check_version raises packaging.version.InvalidVersion when given an invalid version string.","pooch.get_logger returns the default pooch Logger instance and supports configuring logging levels.","pooch.HTTPDownloader initializes with configurable download parameters including chunk size, progress bar display, and custom request headers.","pooch.DOIDownloader initializes with configurable DOI download options including chunk size and request timeout."],"goal":"verify pooch in pkg:pypi/pooch@1.9.0","kind":"HOW","packages":["pkg:pypi/pooch@1.9.0"],"schemaVersion":1,"symbols":["pooch"]},"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","runtimeVersion":"3.12","schemaVersion":1},"license":"MIT-0","packages":["pkg:pypi/pooch@1.9.0"],"schemaVersion":1,"subject":"pkg:pypi/pooch@1.9.0","symbols":["pooch"],"verifierAdapter":"python@1"}
[project]
name = "sample-pooch"
version = "0.1.0"
requires-python = ">=3.9"
dependencies = [
"pooch==1.9.0",
]
certifi==2026.7.22
charset-normalizer==3.5.1
idna==3.19
packaging==26.3
platformdirs==4.11.7
pooch==1.9.0
requests==2.34.2
urllib3==2.7.0
{
"schemaVersion": 1,
"goal": "verify pooch in pkg:pypi/pooch@1.9.0",
"kind": "HOW",
"packages": [
"pkg:pypi/pooch@1.9.0"
],
"symbols": [
"pooch"
]
}
import hashlib
import logging
import pathlib
import tempfile
import packaging.version
import pooch
# 1. Verify pooch.__version__
assert hasattr(pooch, "__version__"), "pooch module should export __version__"
assert "1.9.0" in pooch.__version__, f"Unexpected version string: {pooch.__version__}"
# 2. Verify pooch.os_cache
cache_path = pooch.os_cache("sample-app")
assert isinstance(cache_path, pathlib.Path), "os_cache must return a pathlib.Path"
assert "sample-app" in str(cache_path), f"os_cache path should contain project name: {cache_path}"
# 3. Verify pooch.file_hash
with tempfile.TemporaryDirectory() as tmpdir:
test_file = pathlib.Path(tmpdir) / "test_data.bin"
test_bytes = b"CodeSampleX offline verification payload"
test_file.write_bytes(test_bytes)
# Default algorithm (sha256)
sha256_hash = pooch.file_hash(str(test_file))
expected_sha256 = hashlib.sha256(test_bytes).hexdigest()
assert sha256_hash == expected_sha256, f"sha256 mismatch: {sha256_hash} != {expected_sha256}"
# Custom algorithm (md5)
md5_hash = pooch.file_hash(str(test_file), alg="md5")
expected_md5 = hashlib.md5(test_bytes).hexdigest()
assert md5_hash == expected_md5, f"md5 mismatch: {md5_hash} != {expected_md5}"
# 4. Verify pooch.check_version with PEP440 compliant and dev versions
v_clean = pooch.check_version("1.9.0")
assert v_clean == "1.9.0", f"Expected '1.9.0', got {v_clean}"
v_dev = pooch.check_version("1.9.0+dev.123", fallback="main")
assert v_dev == "main", f"Expected fallback 'main', got {v_dev}"
# 5. Verify pooch.check_version raises InvalidVersion on malformed versions
try:
pooch.check_version("invalid_format_version!!!")
raise AssertionError("pooch.check_version should raise InvalidVersion on invalid input")
except packaging.version.InvalidVersion:
pass
# 6. Verify pooch.get_logger
logger = pooch.get_logger()
assert isinstance(logger, logging.Logger), "get_logger must return a logging.Logger"
assert logger.name == "pooch", f"Logger name must be 'pooch', got {logger.name}"
orig_level = logger.level
try:
logger.setLevel(logging.INFO)
assert logger.level == logging.INFO, "Logger level should be updated"
finally:
logger.setLevel(orig_level)
# 7. Verify pooch.HTTPDownloader
http_downloader = pooch.HTTPDownloader(chunk_size=4096, progressbar=False, headers={"User-Agent": "sample-agent"})
assert http_downloader.chunk_size == 4096, f"Expected chunk_size 4096, got {http_downloader.chunk_size}"
assert http_downloader.progressbar is False, "Expected progressbar False"
assert http_downloader.kwargs == {"headers": {"User-Agent": "sample-agent"}}, "kwargs mismatch"
# 8. Verify pooch.DOIDownloader
doi_downloader = pooch.DOIDownloader(chunk_size=8192, progressbar=False, timeout=60)
assert doi_downloader.chunk_size == 8192, f"Expected chunk_size 8192, got {doi_downloader.chunk_size}"
assert doi_downloader.progressbar is False, "Expected progressbar False"
assert doi_downloader.timeout == 60, f"Expected timeout 60, got {doi_downloader.timeout}"
print("CONTRACT PASS: pooch verified offline")
Seeder de origem
anônimo