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.8.3

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.8.3
File Size Uploaded
warpweft-0.8.3.tar.gz 324.1 kB Details

Built distribution (wheel)

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

Total release size: 443.9 kB

Release files / warpweft-0.8.3.tar.gz

Download URL warpweft-0.8.3.tar.gz
Size 324.1 kB
Tags Source
SHA-256 checksum
How to use checksums
51f4656746b4c7a216f9117de7851c2ca333cd694bf5b584a6043334d5ef00c8
BLAKE2b-256 checksum
How to use checksums
c7eaaf7dc9898311578543944a59686e402ac07e3f744ab493698feb6ad9f57e
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 29, 2026.

Transparency log

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

Download URL warpweft-0.8.3-py3-none-any.whl
Size 119.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d2d7edc22e7b668676bc1e8ac983a52a13b626ebdd308e5e76f3325401660f27
BLAKE2b-256 checksum
How to use checksums
b8f7d53bdc23d5ebca58ac7eeadaf2333ec3ef20e3628d1a6ad313081baab115
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 29, 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

This release

0.8.3 This release

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

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