osp-provider-contracts
Shared Python contract package for OSP providers and orchestrator: typed interfaces, canonical errors, capabilities schema, idempotency helpers, and a reusable provider conformance kit.
For maintainer-facing internals and invariants, see src/README.md.
Scope (v0.1)
- Small, explicit provider protocol
- Shared request/result/context types
- One executable-mode vocabulary (
checkorapply) - Canonical error taxonomy with retry metadata
- Capabilities and manifest v2 schema validation
- Conformance assertions and a reusable pytest suite for provider CI
- Canonical gate reason enum for approval-required flows
No pytest plugin is included. Providers opt in by subclassing the conformance suite from a local test module.
Execution
Planning is read-only and does not execute provider actions. An executed task
is either ExecutionMode.CHECK when its canonical dry_run or check flag is
true, or ExecutionMode.APPLY otherwise:
from osp_provider_contracts import ExecutionMode, resolve_execution_mode
mode = resolve_execution_mode(request.payload)
if mode is ExecutionMode.APPLY:
create_vm()
The resolver deliberately ignores a payload's execution_mode string so an
ordinary dispatched task cannot become an unmarked successful no-op.
Approval-Required Contract
Providers that need human approval should raise ValidationError with
detail="approval_required" and include a structured extra payload:
gate_reason: one ofosp_provider_contracts.GateReasonstring valuesimportance: integer risk/urgency indicator when applicable (1 => 2 approvals)required_approvals: optional explicit total quorum override (e.g., 2 for dual control)reason: stable machine-readable reason stringdetails: provider-specific context for operators and audit
Providers do not send approval-authority tiers. required_approvals only
requests the total number of approvals. The orchestrator may add fixed-tier
requirements from gate policy, such as provider-admin sudo or global
break-glass approval, without changing provider payloads.
Install
pip install osp-provider-contracts
Development
env -u VIRTUAL_ENV uv sync --extra dev
hatch shell
hatch run dev:check
hatch run dev:build
hatch run dev:verify
Release
See docs/release.md for the manual/gated publish flow.
Tag and push:
git tag v0.2.0
git push origin v0.2.0
Release files for osp-provider-contracts 0.3.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| osp_provider_contracts-0.3.5.tar.gz | 1.3 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| osp_provider_contracts-0.3.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 1.4 MB
Release files / osp_provider_contracts-0.3.5.tar.gz
| Download URL | osp_provider_contracts-0.3.5.tar.gz |
|---|---|
| Size | 1.3 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9ab3ec6f89426bf2cf5ec3fa424548b63d7a254419672192a75daa632d352816
|
|
BLAKE2b-256 checksum How to use checksums |
d3df041a517ea3fd2e79f88b9488a5e3e7cccaedf0e56858d6656645ab5e3956
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.5
|
Release files / osp_provider_contracts-0.3.5-py3-none-any.whl
| Download URL | osp_provider_contracts-0.3.5-py3-none-any.whl |
|---|---|
| Size | 54.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c422988a4ded7924491bcbea523d42bdfae8489e7150062934378ba6b54604d5
|
|
BLAKE2b-256 checksum How to use checksums |
c38457b3264c9bac7df8d4743fdc60e82ba21d036404efbabcad1b1bba995484
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.5
|