Skip to main content

warpweft

A declarative framework for resilient, observable service components in async Python.

PyPI version Supported Python versions CI Documentation License: Apache-2.0

The idea

In weaving, the warp threads are strung taut on the loom and the weft is woven across them - together they make the cloth. warpweft applies that metaphor to services:

You write the warp - your component's business calls. The framework weaves the weft - retry, timeout, circuit breaking, caching, concurrency limiting, graceful degradation and telemetry - across every call.

The weave is declared in configuration, not scattered through your code. You write a plain async method; warpweft turns it into a guarded, observable, composable unit driven by policy. Change the resilience behaviour of a call by editing config - environment, TOML or YAML - never the call site.

Why warpweft

  • Resilience, declared - retry, timeout, circuit breaker, caching, concurrency limiting and graceful degradation wrap every call, driven by config rather than boilerplate.
  • Observable by default - OpenTelemetry spans and metrics emitted with consistent semantic conventions, no manual instrumentation.
  • Composition & lifecycle - a component registry, dependency-injection container, dependency graph, ordered startup/shutdown and health checks.
  • Config-driven - policies resolved from environment, TOML or YAML; the same component runs differently per deployment with zero code change.
  • Ergonomic units - model a single callable operation as an Action, or shared infrastructure as a Provider, both built on the same core.
  • LLM-ready - expose invocables as Model Context Protocol tools with flat, typed schemas.
  • Async & typed - built on anyio (runs on asyncio and trio) and checked with mypy --strict throughout.

Install

pip install warpweft          # core + runtime
pip install warpweft[mcp]     # + expose components as Model Context Protocol tools
pip install warpweft[yaml]    # + YAML config files

Quickstart

Write a component's calls; declare their resilience in config:

from pydantic import BaseModel

from warpweft import AComponent, App, component, invocable


class WeatherSettings(BaseModel):
    base_url: str


@component
class Weather(AComponent[WeatherSettings, str, dict]):
    @invocable
    async def forecast(self, city: str) -> dict:
        resp = await self._client.get(f"/forecast/{city}")
        resp.raise_for_status()
        return resp.json()


app = App(
    env_prefix="MYAPP",
    # retry is declared, not coded: 3 attempts with backoff, applied to every call
    config={"weather": {"policy": {"retry": {"attempts": 3, "base_delay": 0.1, "max_delay": 1.0}}}},
)

async with app.run():
    forecast = await app.proxy(Weather).forecast(city="oslo")  # runs through the chain

Everything useful is importable from warpweft; focused surfaces have their own module - warpweft.formats (field formats), warpweft.testing (test helpers) and warpweft.mcp (MCP tools, with the extra). The internal layers remain available as warpweft.core.* and warpweft.runtime.*.

License

Apache-2.0 - see LICENSE. Contributions are welcome; see CONTRIBUTING.md.

Metadata

Release files for warpweft 0.6.1

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

Source distribution (sdist)

Source distribution for warpweft 0.6.1
File Size Uploaded
warpweft-0.6.1.tar.gz 293.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for warpweft 0.6.1
File Interpreter ABI Platform
warpweft-0.6.1-py3-none-any.whl Python 3 none any Details

Total release size: 404.0 kB

Release files / warpweft-0.6.1.tar.gz

Download URL warpweft-0.6.1.tar.gz
Size 293.4 kB
Tags Source
SHA-256 checksum
How to use checksums
9ed50722bbaa9faadb3293a65b195a14b37cfa098b350337b2e2c98f324fa125
BLAKE2b-256 checksum
How to use checksums
53e547d51abfc1f1a286a16f7e07a2a6897137ea6ce509c7afa848bef583c080
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 21, 2026.

Transparency log

Release files / warpweft-0.6.1-py3-none-any.whl

Download URL warpweft-0.6.1-py3-none-any.whl
Size 110.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7351f526bfeb5e3c20439389d18eb011a74b156baf50e3e31eddca52b8223ce9
BLAKE2b-256 checksum
How to use checksums
096b4f1d61e75fb1025085aca516716fbcd15c37c663696ba34094758236481d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 21, 2026.

Transparency log

Release history Release notifications | RSS feed

0.8.7

2 release files

0.8.6

2 release files

0.8.5

2 release files

0.8.4

2 release files

0.8.3

2 release files

0.8.2

2 release files

0.8.1

2 release files

0.8.0

2 release files

0.7.0

2 release files

This release

0.6.1 This release

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

2 release files

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