CodeSampleX

Sample

fastapi 0.141.1: __version__

Verified sample for pypi fastapi 0.141.1: __version__. The contract ran on python 3.12 · linux alpine/x64 · docker and passed.

sha256:8db5e7649755ae9e2b41a117d0e8305a4b516d56ac2b74d9699865d057f8e7b4

This network offers one thing: a sample that builds. It ran the sample in a sandbox and kept the signed receipt. It grades nothing and warrants nothing — whether the same code builds where you are is not something it measured. How many distinct signing keys filed a passing contract receipt. One is the author alone; more than one means somebody else built it too. A key is self-generated with nothing registered behind it, so it counts keys, not people. MIT-0

Execution evidence

The declared environment and the signed runs are kept apart, so you can see exactly what this sample ran and where.

Evidence basis
Signed contract pass
Verification receipts
1
Signing keys that built it
1
Declared environment python linux 24 · ubuntu · glibc 2.39 x64 python python pip

Verification-run environments

Environment Contract Stages Run
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-28

Case

HOW
Goal
verify fastapi.__version__ in pkg:pypi/fastapi@0.141.1
Packages
Symbols
  • fastapi.__version__
Environment
python
Created
2026-08-28T04:20:23Z

Contract

  1. fastapi.__version__ is accessible as a top-level module attribute and exportable via 'from fastapi import __version__'.
  2. fastapi.__version__ is a string exactly equal to '0.141.1' matching the pinned distribution version.
  3. fastapi.__version__ adheres to semantic versioning format with major=0, minor=141, patch=1 parseable into integer components.
  4. fastapi.__version__ matches the installed distribution metadata version reported by importlib.metadata.version('fastapi').

Files

  • NOTES.md
  • PROMPT.md
  • csx.json
  • requirements.txt
  • spec.json
  • test/contract.py

Download the source artifact (tar.gz)

Source

NOTES.md
# FastAPI Version Verification

This sample verifies `fastapi.__version__` in `fastapi` 0.141.1.

The contract verifies:
- `fastapi.__version__` is exposed as a module attribute and matches `from fastapi import __version__`.
- `fastapi.__version__` is a string equal to `"0.141.1"`.
- `fastapi.__version__` satisfies semantic version format (`0.141.1`) and parses into `(0, 141, 1)`.
- `fastapi.__version__` matches the package version from `importlib.metadata.version("fastapi")`.
PROMPT.md
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 fastapi.__version__ in pkg:pypi/fastapi@0.141.1
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:pypi/fastapi@0.141.1
Demonstrate these symbols/APIs:
  - fastapi.__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.
csx.json
{"case":{"caseId":"case:sha256:a81164946177208fe6e609ae75e6832f2adf670dc1c953ad360e1dc3f2714592","contract":["fastapi.__version__ is accessible as a top-level module attribute and exportable via 'from fastapi import __version__'.","fastapi.__version__ is a string exactly equal to '0.141.1' matching the pinned distribution version.","fastapi.__version__ adheres to semantic versioning format with major=0, minor=141, patch=1 parseable into integer components.","fastapi.__version__ matches the installed distribution metadata version reported by importlib.metadata.version('fastapi')."],"goal":"verify fastapi.__version__ in pkg:pypi/fastapi@0.141.1","kind":"HOW","packages":["pkg:pypi/fastapi@0.141.1"],"schemaVersion":1,"symbols":["fastapi.__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/fastapi@0.141.1"],"schemaVersion":1,"subject":"pkg:pypi/fastapi@0.141.1","symbols":["fastapi.__version__"],"verifierAdapter":"python@1"}
requirements.txt
fastapi==0.141.1
starlette==1.6.0
annotated-doc==0.0.5
pydantic==2.13.4
pydantic-core==2.46.4
typing-extensions==4.16.0
typing-inspection==0.4.4
annotated-types==0.8.0
anyio==4.14.2
idna==3.18
spec.json
{
  "schemaVersion": 1,
  "goal": "verify fastapi.__version__ in pkg:pypi/fastapi@0.141.1",
  "kind": "HOW",
  "packages": [
    "pkg:pypi/fastapi@0.141.1"
  ],
  "symbols": [
    "fastapi.__version__"
  ]
}
test/contract.py
import importlib.metadata
import re
import fastapi
from fastapi import __version__

# 1. Verify fastapi.__version__ is accessible and matches the imported __version__ symbol
assert hasattr(fastapi, "__version__"), "fastapi module must expose __version__"
assert isinstance(fastapi.__version__, str), f"Expected str for __version__, got {type(fastapi.__version__)}"
assert fastapi.__version__ is __version__, "__version__ imported directly must be identical to fastapi.__version__"

# 2. Verify fastapi.__version__ matches the exact pinned version "0.141.1"
assert fastapi.__version__ == "0.141.1", f"Expected version '0.141.1', got '{fastapi.__version__}'"

# 3. Verify semantic versioning format and integer component parsing
match = re.match(r"^(\d+)\.(\d+)\.(\d+)$", fastapi.__version__)
assert match is not None, f"Version '{fastapi.__version__}' does not match SemVer pattern"

major, minor, patch = map(int, match.groups())
assert major == 0, f"Expected major 0, got {major}"
assert minor == 141, f"Expected minor 141, got {minor}"
assert patch == 1, f"Expected patch 1, got {patch}"

# 4. Verify consistency with importlib.metadata distribution version
dist_version = importlib.metadata.version("fastapi")
assert fastapi.__version__ == dist_version, (
    f"Module version '{fastapi.__version__}' does not match package metadata '{dist_version}'"
)

print(f"CONTRACT PASS: fastapi.__version__ == {fastapi.__version__} verified offline")

Origin Seeder

anonymous