SetSpec
Every versioned data contract that crosses an application boundary: benchmark results, capability evidence, event/error envelopes, prompt records.
Status: 0.3.0 — Phases 1–2, 3A and 4 complete, and the v1.0 contracts are frozen. Eight
payload types are published at 1.0 — model.identity, machine.profile, benchmark.result,
benchmark.run_summary, capability.evidence, benchmark.evidence_bundle,
benchmark.goal_pack and benchmark.calibration_report — each with generated JSON Schema and at
least three golden payloads shipped as package data. setspec.DRAFT_SCHEMAS is empty, which is
where the freeze is readable at runtime rather than only stated here; from now on a new optional
field is a minor bump and anything else is a major, enforced by a snapshot diff in CI.
The schema catalogue lists every payload type, its artifacts, and the cross-field rules the JSON Schema cannot express. Event and error envelopes (Phase 3) and prompt records (Phase 5) are not yet written and are therefore not part of the freeze. See the development plan for what each phase adds.
Part of the Local AI Suite.
Install
pip install setspec
Quickstart
Write a document, then read it back:
from setspec import GeneratorInfo, SchemaVersion, dump_envelope, load_envelope
generator = GeneratorInfo(name="freeweight", version="1.0.0")
document = dump_envelope(
{"tokens_per_second": 42.0},
schema="benchmark.result",
version=SchemaVersion(1, 0),
generator=generator,
)
envelope = load_envelope(document, expect="benchmark.result", supported=[SchemaVersion(1, 0)])
assert envelope.payload == {"tokens_per_second": 42.0}
dump_envelope returns canonical JSON: byte-identical for equal input, on every platform and
Python version, so a document can be hashed and diffed as well as read.
Payload types come in two halves generated from one definition — a strict Out for writers and a
preserving In for readers (ADR-0009 rule 4):
from setspec import PayloadDefinition, payload_models
from setspec.serialization import MeasurementField
class ResultFields(PayloadDefinition):
reading: MeasurementField
unit: str
ResultOut, ResultIn = payload_models(ResultFields)
# A reader keeps what a newer writer added, so a re-export loses nothing.
received = ResultIn.model_validate({"reading": 1.5, "unit": "ms", "confidence": 0.87})
assert received.extras == {"confidence": 0.87}
A measurement this environment cannot provide is UNSUPPORTED, which serializes as the string
"unsupported" — never null, never 0
(ADR-0016).
Phase 2's payload types live in their own versioned modules, not the top-level package, so that a
future benchmark.result 2.0 can coexist with v1 rather than racing it for one name
(ADR-0009 rule 6):
from setspec.capability.v1 import CapabilityEvidenceOut
evidence = CapabilityEvidenceOut.model_validate(
{
"model": {
"provider_kind": "ollama",
"provider_model_name": "qwen3.5:9b-q8_0",
"artifact_digest": None,
"identity_confidence": "name_only",
"canonical_id": "ollama/qwen3.5:9b-q8_0@unknown",
"observed_at": "2026-08-20T09:00:00.000Z",
},
"runtime_profile_hash": "a" * 16,
"machine_fingerprint": "b" * 64,
"capability_id": "coding.python", # unenumerated specialization of the known root "coding"
"score": 0.82,
"confidence": 0.71,
"sample_count": 40,
"excluded_count": 2,
"dispersion": 0.09,
"measured_at": "2026-08-20T00:00:00.000Z",
"computed_at": "2026-08-22T00:00:00.000Z",
"policy_version": "1.0",
"vocabulary_version": "1.0",
"environment": {"provider_kind": "ollama", "provider_version": "0.32.13"},
}
)
assert evidence.capability_id == "coding.python"
See docs/packages/setspec/spec.md §7 for the full public API and §20 for the acceptance criteria.
Documentation
Project documentation lives under docs/. Start with docs/README.md.
| Read this | For |
|---|---|
| docs/packages/setspec/spec.md | Purpose, scope, non-goals, public contracts, configuration, acceptance criteria |
| docs/packages/setspec/development-plan.md | The phased build plan: goals, work, tests, acceptance criteria per phase |
Development
python -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"
pre-commit install
pytest -m "not live and not performance"
See CONTRIBUTING.md for the full workflow and SECURITY.md for
how to report a vulnerability.
License
Apache-2.0 — see LICENSE.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file setspec-0.3.0.tar.gz.
File metadata
- Download URL: setspec-0.3.0.tar.gz
- Upload date:
- Size: 212.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
51aff8ba954b24e13e658d81ea1a926ebe1f9d235f180f174c3bdc40d5aa1e04
|
|
| MD5 |
d6227444a15a22e4c4ebae16de7f05db
|
|
| BLAKE2b-256 |
053c36c89a2cb92503c22bfc7937071dc4a4577c4900889d3f4c6dd975c58055
|
Provenance
The following attestation bundles were made for setspec-0.3.0.tar.gz:
Publisher:
release.yml on JPKell/SetSpec
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
setspec-0.3.0.tar.gz -
Subject digest:
51aff8ba954b24e13e658d81ea1a926ebe1f9d235f180f174c3bdc40d5aa1e04 - Sigstore transparency entry: 2632608483
- Sigstore integration time:
-
Permalink:
JPKell/SetSpec@a4692565b7e1c6236fa49f5d01983d1d988bd32e -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/JPKell
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@a4692565b7e1c6236fa49f5d01983d1d988bd32e -
Trigger Event:
push
-
Statement type:
File details
Details for the file setspec-0.3.0-py3-none-any.whl.
File metadata
- Download URL: setspec-0.3.0-py3-none-any.whl
- Upload date:
- Size: 137.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ce61d62826b65563f0c9690e47a4c6098bfb8c3c9e54b09831b2d807d0e205ff
|
|
| MD5 |
50605f534371344e086f781bbd226ece
|
|
| BLAKE2b-256 |
8a2c4876bf476c1ae5d116df42798cef7f02b9b76970ab79f09812118c4e68dc
|
Provenance
The following attestation bundles were made for setspec-0.3.0-py3-none-any.whl:
Publisher:
release.yml on JPKell/SetSpec
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
setspec-0.3.0-py3-none-any.whl -
Subject digest:
ce61d62826b65563f0c9690e47a4c6098bfb8c3c9e54b09831b2d807d0e205ff - Sigstore transparency entry: 2632608505
- Sigstore integration time:
-
Permalink:
JPKell/SetSpec@a4692565b7e1c6236fa49f5d01983d1d988bd32e -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/JPKell
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@a4692565b7e1c6236fa49f5d01983d1d988bd32e -
Trigger Event:
push
-
Statement type: