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.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 warpweft 0.6.0
File Size Uploaded
warpweft-0.6.0.tar.gz 293.3 kB Details

Built distribution (wheel)

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

Total release size: 403.8 kB

Release files / warpweft-0.6.0.tar.gz

Download URL warpweft-0.6.0.tar.gz
Size 293.3 kB
Tags Source
SHA-256 checksum
How to use checksums
93e6986a4c08c1567efadbdda397c60336ab26fe7c93681c3f0ae968ff3babff
BLAKE2b-256 checksum
How to use checksums
f5593c6157adf316432345adecb84cac2d914ad3410d59dcd7790467703409ad
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.0-py3-none-any.whl

Download URL warpweft-0.6.0-py3-none-any.whl
Size 110.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6cd84c7f4abeb39e58ae80edd8b0a27737697251b907217eae49d48db695aa4d
BLAKE2b-256 checksum
How to use checksums
05fe18787bb2e6e22aa614a435048bc9be649aa96234fb772d347e1d08510660
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

0.6.1

2 release files

This release

0.6.0 This release

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