Introducing wrapture

AI-generated summary of reporting by Simon Willison’s Weblog. Read the original for the full story.

Why it matters

Wrapture gives Python engineers a single monkeypatching-based tool to replace unittest.mock stubs and add OpenTelemetry tracing to code they don't control.

Read this as

A veteran Python developer named Graham Dumpleton has released Wrapture, a new free tool, just weeks old. It lets programmers wrap any function so its behaviour can be watched or changed without editing the original code. That means it can be used both for testing, standing in for slow or risky parts of a program, and for tracing what a program does. Notably, every line was written by an AI assistant under his direction.

Wrapture, a new open-source Python library from wrapt creator Graham Dumpleton, targets the testing and observability tooling market currently served by Python's built-in unittest.mock. It also carries an unusually strong pitch: it was built entirely by an AI assistant under expert direction, not vibe coded. For teams, the risk is low and the gain is a configuration-based way to trace existing projects; it's weeks old, so maturity is unproven.

Wrapture extends wrapt's monkeypatching to testing and tracing: bindings like wrapture.binding(Gateway, "charge") support stubbed returns and result transforms via context managers, positioning it against unittest.mock. Tracing targets are declared in TOML config with sinks such as jsonlines, and OpenTelemetry export is built in. The project is a few weeks old, and Dumpleton states every line of code and documentation was AI-written under his design direction.

Read the original

This summary exists to save you time, not to replace the source.

Also covered by 1 other source

Same story, reported independently. Useful for a second read.

Key terms

Wrapture wrapt Python OpenTelemetry unittest.mock mod_wsgi

Was this summary useful?

One click, anonymous. It tells us which summaries to re-run.

Related reading