Exemple
numba 0.67.0rc1: vectorize
Échantillon vérifié pour pypi numba 0.67.0rc1: vectorize. Le contrat s'est exécuté sur python 3.12 · linux debian/x64 · docker et a réussi.
sha256:577410fef81fcea21ddb684de2ab824e575161ec1d6342e80adb34d6eea61413
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é
linux 24 · ubuntu · glibc 2.39 x64 pip
Environnements des exécutions de vérification
| Environnement | Contrat | Étapes | Exécution |
|---|---|---|---|
| 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-02 |
Cas
HOW- Objectif
- verify numba.vectorize in pkg:pypi/numba@0.67.0rc1
- Paquets
- Symboles
-
- numba.vectorize
- Créé
- 2026-09-02T13:21:01Z
Contrat
- assert vectorize compiles ufunc with explicit integer and float signatures on scalar and 1D array inputs
- assert vectorize compiles dynamically without explicit signatures on invocation
- assert vectorize performs multi-dimensional array broadcasting
- assert vectorize generated ufunc supports reduce and accumulate methods
- assert vectorize with explicit signature raises TypeError when called with incompatible argument types
Fichiers
- PROMPT.md
- csx.json
- pyproject.toml
- requirements.txt
- spec.json
- test/contract.py
Code source
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 numba.vectorize in pkg:pypi/numba@0.67.0rc1
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:pypi/numba@0.67.0rc1
Demonstrate these symbols/APIs:
- numba.vectorize
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:14fc57c4238e293e2114a9c09b0ea81810c06b988bb877df1d2fc5f2c848e52b","contract":["assert vectorize compiles ufunc with explicit integer and float signatures on scalar and 1D array inputs","assert vectorize compiles dynamically without explicit signatures on invocation","assert vectorize performs multi-dimensional array broadcasting","assert vectorize generated ufunc supports reduce and accumulate methods","assert vectorize with explicit signature raises TypeError when called with incompatible argument types"],"goal":"verify numba.vectorize in pkg:pypi/numba@0.67.0rc1","kind":"HOW","packages":["pkg:pypi/numba@0.67.0rc1"],"schemaVersion":1,"symbols":["numba.vectorize"]},"contractCommand":["python","test/contract.py"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"pypi","libc":"glibc","libcVersion":"2.39","os":"linux","osVersionBucket":"24","packageManager":"pip","schemaVersion":1},"license":"MIT-0","packages":["pkg:pypi/numba@0.67.0rc1"],"schemaVersion":1,"subject":"pkg:pypi/numba@0.67.0rc1","symbols":["numba.vectorize"],"verifierAdapter":"python@1"}
[project]
name = "verify-numba"
version = "0.1.0"
dependencies = [
"llvmlite==0.49.0",
"numba==0.67.0rc1",
"numpy==2.5.2",
]
llvmlite==0.49.0
numba==0.67.0rc1
numpy==2.5.2
{
"schemaVersion": 1,
"goal": "verify numba.vectorize in pkg:pypi/numba@0.67.0rc1",
"kind": "HOW",
"packages": [
"pkg:pypi/numba@0.67.0rc1"
],
"symbols": [
"numba.vectorize"
],
"constraints": {
"executionContext": "node"
},
"runtimeConditions": {
"ecosystem": "npm",
"language": "javascript",
"moduleSystem": "cjs",
"packageManager": "npm@10.9.8",
"runtime": "node@22.23.2"
}
}
import numpy as np
import numba
from numba import vectorize, int64, float64
def test_vectorize_explicit_signatures():
@vectorize([int64(int64, int64), float64(float64, float64)])
def vec_add(x, y):
return x + y
# Scalar inputs
assert vec_add(10, 20) == 30
assert vec_add(1.5, 2.5) == 4.0
# 1D array inputs
a = np.array([1, 2, 3], dtype=np.int64)
b = np.array([4, 5, 6], dtype=np.int64)
res = vec_add(a, b)
assert isinstance(res, np.ndarray)
assert np.array_equal(res, np.array([5, 7, 9], dtype=np.int64))
# Broadcasting: 1D array + scalar
res_bcast = vec_add(a, 10)
assert np.array_equal(res_bcast, np.array([11, 12, 13], dtype=np.int64))
def test_vectorize_dynamic_compilation():
@vectorize
def vec_mul(x, y):
return x * y
# Compiles dynamically on invocation
res_scalar = vec_mul(3, 4)
assert res_scalar == 12
arr1 = np.array([1.0, 2.0, 3.0], dtype=np.float64)
arr2 = np.array([2.0, 3.0, 4.0], dtype=np.float64)
res_arr = vec_mul(arr1, arr2)
assert np.allclose(res_arr, np.array([2.0, 6.0, 12.0]))
def test_vectorize_multidimensional_broadcasting():
@vectorize([float64(float64, float64)])
def vec_sub(x, y):
return x - y
mat = np.array([[10.0, 20.0, 30.0], [40.0, 50.0, 60.0]], dtype=np.float64)
row = np.array([1.0, 2.0, 3.0], dtype=np.float64)
res = vec_sub(mat, row)
expected = np.array([[9.0, 18.0, 27.0], [39.0, 48.0, 57.0]], dtype=np.float64)
assert res.shape == (2, 3)
assert np.allclose(res, expected)
def test_vectorize_ufunc_methods():
@vectorize([int64(int64, int64)])
def vec_sum(x, y):
return x + y
arr = np.array([1, 2, 3, 4, 5], dtype=np.int64)
# ufunc reduce method
total = vec_sum.reduce(arr)
assert total == 15
# ufunc accumulate method
accum = vec_sum.accumulate(arr)
assert np.array_equal(accum, np.array([1, 3, 6, 10, 15], dtype=np.int64))
def test_vectorize_type_error():
@vectorize([int64(int64, int64)])
def vec_int_add(x, y):
return x + y
try:
vec_int_add("invalid", "strings")
assert False, "Should have raised TypeError"
except TypeError as e:
assert isinstance(e, TypeError)
def main():
test_vectorize_explicit_signatures()
test_vectorize_dynamic_compilation()
test_vectorize_multidimensional_broadcasting()
test_vectorize_ufunc_methods()
test_vectorize_type_error()
print("All vectorize contract assertions passed.")
if __name__ == "__main__":
main()
Seeder d'origine
anonyme