Ejemplo
certifi 2026.2.25: __main__
Muestra verificada para pypi certifi 2026.2.25: __main__. El contrato se ejecutó en python 3.12 · linux alpine/x64 · docker y pasó.
sha256:2e355a96fecb9f03cf85f79d5b7908d3ad86fd27d21dd6ba3a7ec833b0003465
Esta red ofrece una sola cosa: una muestra que compila. La ejecutó en un sandbox y guardó el recibo firmado. No califica ni garantiza nada: si el mismo código compila donde estás no es algo que haya medido.
Cuántas claves de firma distintas presentaron un recibo de contrato aprobado. Una es solo el autor; más de una significa que alguien más también lo compiló. Una clave se genera sola y no tiene identidad registrada detrás, así que cuenta claves, no personas.
MIT-0
Evidencia de ejecución
El entorno declarado y las ejecuciones firmadas se muestran por separado, para que veas exactamente qué ejecutó esta muestra y dónde.
- Base de evidencia
- Contrato firmado aprobado
- Recibos de verificación
- 2
- Claves de firma que lo compilaron
- 1
Entorno declarado
python 3.12 linux 24 · ubuntu · glibc 2.39 x64 python 3.12 python pip 24
Entornos de las ejecuciones de verificación
| Entorno | Contrato | Etapas | Ejecución |
|---|---|---|---|
| python 3.12 · linux alpine/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · python@1 |
2026-08-20 |
| 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-08 |
Caso
HOW- Objetivo
- verify pkg:pypi/certifi@2026.2.25
- Paquetes
- Símbolos
-
- certifi.__main__
- Entorno
- python 3.12
- Creado
- 2026-08-20T11:22:07Z
Contrato
- certifi.__main__ executed without arguments prints the CA bundle path and exits 0
- certifi.__main__ executed with -c flag prints the certificate bundle contents
- certifi.__main__ executed with --contents flag prints the identical certificate bundle contents
- certifi.__main__ executed with --help flag displays usage options and exits 0
- certifi.__main__ executed with unrecognized arguments exits with non-zero status code
Archivos
- PROMPT.md
- csx.json
- pyproject.toml
- requirements.txt
- spec.json
- src/__init__.py
- src/sample.py
- test/contract.py
Código fuente
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/certifi@2026.2.25
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:pypi/certifi@2026.2.25
Constraints:
- executionContext: node
Required runtime conditions:
- ecosystem: npm
- language: javascript
- moduleSystem: cjs
- packageManager: npm@10.9.8
- runtime: node@22.23.2
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:d33f1aec1abd36f99b4fb682c047881971b5c181cb6bd7297de2f26c717000d9","contract":["certifi.__main__ executed without arguments prints the CA bundle path and exits 0","certifi.__main__ executed with -c flag prints the certificate bundle contents","certifi.__main__ executed with --contents flag prints the identical certificate bundle contents","certifi.__main__ executed with --help flag displays usage options and exits 0","certifi.__main__ executed with unrecognized arguments exits with non-zero status code"],"goal":"verify pkg:pypi/certifi@2026.2.25","kind":"HOW","packages":["pkg:pypi/certifi@2026.2.25"],"schemaVersion":1,"symbols":["certifi.__main__"]},"contractCommand":["python3","test/contract.py"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"pypi","language":"python","libc":"glibc","libcVersion":"2.39","moduleSystem":"standard","os":"linux","osVersionBucket":"24","packageManager":"pip","packageManagerVersion":"24.0","runtime":"python","runtimeVersion":"3.12","schemaVersion":1},"license":"MIT-0","packages":["pkg:pypi/certifi@2026.2.25"],"schemaVersion":1,"symbols":["certifi.__main__"],"verifierAdapter":"python@1"}
[project]
name = "certifi-cli-sample"
version = "0.1.0"
description = "Clean-room verification sample for certifi CLI module"
requires-python = ">=3.9"
dependencies = [
"certifi==2026.2.25"
]
certifi==2026.2.25
{
"schemaVersion": 1,
"goal": "verify pkg:pypi/certifi@2026.2.25",
"kind": "HOW",
"packages": [
"pkg:pypi/certifi@2026.2.25"
],
"constraints": {
"executionContext": "node"
},
"runtimeConditions": {
"ecosystem": "npm",
"language": "javascript",
"moduleSystem": "cjs",
"packageManager": "npm@10.9.8",
"runtime": "node@22.23.2"
}
}
from .sample import (
run_cli_default,
run_cli_short_contents,
run_cli_long_contents,
run_cli_help,
run_cli_invalid,
)
__all__ = [
"run_cli_default",
"run_cli_short_contents",
"run_cli_long_contents",
"run_cli_help",
"run_cli_invalid",
]
"""Sample demonstrating command-line interface execution of the certifi package."""
import subprocess
import sys
from typing import Tuple
def run_cli_default() -> Tuple[int, str]:
"""Execute certifi CLI without arguments, returning exit code and trimmed stdout."""
result = subprocess.run(
[sys.executable, "-m", "certifi"],
capture_output=True,
text=True,
)
return result.returncode, result.stdout.strip()
def run_cli_short_contents() -> Tuple[int, str]:
"""Execute certifi CLI with -c flag, returning exit code and stdout."""
result = subprocess.run(
[sys.executable, "-m", "certifi", "-c"],
capture_output=True,
text=True,
)
return result.returncode, result.stdout
def run_cli_long_contents() -> Tuple[int, str]:
"""Execute certifi CLI with --contents flag, returning exit code and stdout."""
result = subprocess.run(
[sys.executable, "-m", "certifi", "--contents"],
capture_output=True,
text=True,
)
return result.returncode, result.stdout
def run_cli_help() -> Tuple[int, str]:
"""Execute certifi CLI with --help flag, returning exit code and stdout."""
result = subprocess.run(
[sys.executable, "-m", "certifi", "--help"],
capture_output=True,
text=True,
)
return result.returncode, result.stdout
def run_cli_invalid() -> Tuple[int, str, str]:
"""Execute certifi CLI with an invalid flag, returning exit code, stdout, and stderr."""
result = subprocess.run(
[sys.executable, "-m", "certifi", "--unrecognized-argument-test"],
capture_output=True,
text=True,
)
return result.returncode, result.stdout, result.stderr
"""Contract verification tests for certifi.__main__ command-line interface."""
import os
import sys
from pathlib import Path
src_dir = Path(__file__).resolve().parent.parent / "src"
if str(src_dir) not in sys.path:
sys.path.insert(0, str(src_dir))
import certifi
from sample import (
run_cli_default,
run_cli_short_contents,
run_cli_long_contents,
run_cli_help,
run_cli_invalid,
)
def test_contract_1_default_execution():
"""Assertion 1: certifi.__main__ executed without arguments prints the CA bundle path and exits 0."""
code, output = run_cli_default()
assert code == 0, f"Expected exit code 0, got {code}"
expected_path = certifi.where()
assert output == expected_path, f"CLI output '{output}' must match certifi.where() '{expected_path}'"
assert os.path.exists(output), f"Output path '{output}' must exist on disk"
def test_contract_2_short_contents_flag():
"""Assertion 2: certifi.__main__ executed with -c flag prints the certificate bundle contents."""
code, output = run_cli_short_contents()
assert code == 0, f"Expected exit code 0, got {code}"
assert len(output) > 0, "Output must be non-empty"
assert "-----BEGIN CERTIFICATE-----" in output, "Output must contain PEM certificate header"
assert "-----END CERTIFICATE-----" in output, "Output must contain PEM certificate footer"
expected_contents = certifi.contents()
assert output.strip() == expected_contents.strip(), "CLI output must match certifi.contents()"
def test_contract_3_long_contents_flag():
"""Assertion 3: certifi.__main__ executed with --contents flag prints the identical certificate bundle contents."""
code_short, output_short = run_cli_short_contents()
code_long, output_long = run_cli_long_contents()
assert code_long == 0, f"Expected exit code 0, got {code_long}"
assert output_long == output_short, "--contents output must match -c output exactly"
def test_contract_4_help_flag():
"""Assertion 4: certifi.__main__ executed with --help flag displays usage options and exits 0."""
code, output = run_cli_help()
assert code == 0, f"Expected exit code 0, got {code}"
assert "usage:" in output, "Help output must contain usage string"
assert "-c" in output or "--contents" in output, "Help output must describe contents option"
def test_contract_5_invalid_argument():
"""Assertion 5: certifi.__main__ executed with unrecognized arguments exits with non-zero status code."""
code, stdout, stderr = run_cli_invalid()
assert code != 0, f"Expected non-zero exit code for invalid args, got {code}"
assert "error:" in stderr or "usage:" in stderr or "unrecognized" in stderr, "Error output expected on stderr"
def main():
print("Running contract verification for certifi.__main__ CLI...")
test_contract_1_default_execution()
test_contract_2_short_contents_flag()
test_contract_3_long_contents_flag()
test_contract_4_help_flag()
test_contract_5_invalid_argument()
print("All contract assertions passed successfully.")
if __name__ == "__main__":
main()
Seeder de origen
anónimo