Skip to main content

wt-contracts

Shared interface contracts for wt workflow packages.

Overview

wt-contracts provides type-safe interface definitions (Pydantic models + Protocols) that enable inter-package compatibility across the wt ecosystem. This package contains no implementation logic - only contracts that other packages depend on.

Purpose

The wt architecture separates serializable metadata (@register) from execution features (@task). To enable cross-environment discovery via CLI serialization boundary, we need shared contracts that all packages agree on:

  1. Registry Contract: JSON schema for wt-registry CLI output
  2. Task Execution Contract: Protocol defining task execution interface
  3. Generated CLI Contract: Standard CLI arguments for generated workflows

Package Contents

wt_contracts.registry

Pydantic models for wt-registry CLI output:

  • RegistryMetadata: Function metadata (title, description, tags, deprecation)
  • RegistryEntry: Complete registry entry (metadata + schemas + import info)
  • RegistryOutput: Top-level CLI output format

wt_contracts.task

Protocol for task execution interface:

  • TaskProtocol[P, R]: Generic protocol with methods like .partial(), .call(), .map()

wt_contracts.cli

Standard CLI contracts for generated workflows:

  • WorkflowCLIArgs: Standard CLI arguments
  • WorkflowCLIEnv: Standard environment variables

Installation

pip install wt-contracts
# or
uv add wt-contracts

Usage

from wt_contracts.registry import RegistryOutput, RegistryEntry
from wt_contracts.task import TaskProtocol
from wt_contracts.cli import WorkflowCLIArgs

# Deserialize registry CLI output
registry_data = RegistryOutput.model_validate_json(cli_output)

# Type-check task implementations
def my_task_wrapper(func: Callable[P, R]) -> TaskProtocol[P, R]:
    ...

Development

# Install dependencies (including dev dependencies)
cd wt/wt-contracts

# IMPORTANT: Use --group dev to install pytest, mypy, ruff, etc.
uv sync --group dev

# Run tests
uv run pytest

# Type check
uv run mypy src/

# Lint
uv run ruff check .

Note: This project uses [dependency-groups] instead of [project.optional-dependencies]. You must use --group dev to install dev dependencies. Running uv sync alone will only install production dependencies (pydantic).

Design Philosophy

  • Minimal dependencies: Only pydantic (for validation)
  • No implementation: Pure interface definitions
  • Type-safe: Full mypy strict mode compliance
  • Version stability: Breaking changes require major version bump
  • Lightweight: Fast to install, minimal impact on dependency trees
  • wt-registry: Function registration with JSON schema generation (uses registry contracts)
  • wt-task: Task decorator with execution features (implements task protocol)
  • wt-compiler: Workflow compilation (uses all contracts for discovery + generation)
  • wt-invokers: Workflow invocation (uses CLI contract)
  • wt-runner: FastAPI workflow execution server (uses CLI contract)

License

BSD-3-Clause

Metadata

Release files for wt-contracts 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for wt-contracts 0.3.0
File Size Uploaded Provenance Actions
wt_contracts-0.3.0.tar.gz 92.0 kB Without provenance Details for wt_contracts-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for wt-contracts 0.3.0
File Interpreter ABI Platform Actions
wt_contracts-0.3.0-py3-none-any.whl Python 3 none any Details for wt_contracts-0.3.0-py3-none-any.whl

Total release size: 111.1 kB

Release files / wt_contracts-0.3.0.tar.gz

Download URL wt_contracts-0.3.0.tar.gz
Size 92.0 kB
Tags Source
SHA-256 checksum
How to use checksums
61a2d322cfa0d127bf15328395c9263f2ee73afb83c9d31941af635165c0b1c5
BLAKE2b-256 checksum
How to use checksums
e6a23614214cf867770c5eb3227d1b81422b743a1059be700fb460fc8f65168d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / wt_contracts-0.3.0-py3-none-any.whl

Download URL wt_contracts-0.3.0-py3-none-any.whl
Size 19.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b6f507d0fd987c3ba76efbb665093bc2ecff1d6dbef357493300034385ce7b1f
BLAKE2b-256 checksum
How to use checksums
4dadbe20fcc700c788c31a1bef022ef9406cb42a0f0105791f2383f0cfc4a08d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for wt-contracts 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page