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

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.5
File Size Uploaded
warpweft-0.8.5.tar.gz 326.6 kB Details

Built distribution (wheel)

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

Total release size: 448.6 kB

Release files / warpweft-0.8.5.tar.gz

Download URL warpweft-0.8.5.tar.gz
Size 326.6 kB
Tags Source
SHA-256 checksum
How to use checksums
6a1a39dacddf45234425a517bf29bc2073d325bc67e0f4ae2769512585086f57
BLAKE2b-256 checksum
How to use checksums
12ea3dc7798a6d51b59ecb85381e376c8224cb3858f4df286f49fbdb431e4b15
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.5-py3-none-any.whl

Download URL warpweft-0.8.5-py3-none-any.whl
Size 122.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d467f9e6963c08460d58f97f7d0e669a7a97b7146e7221edb49dd1cafc94ca25
BLAKE2b-256 checksum
How to use checksums
6ef4efe67e7027db45b8fe7a96c8d870d7414ba66da8f5fdf93cac5cf1e3e848
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

This release

0.8.5 This release

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

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