Graham Dumpleton launches Wrapture, a Python testing and tracing tool built entirely by AI
Graham Dumpleton, the developer behind wrapt, mod_wsgi and New Relic's Python agent, has introduced a new library called Wrapture. As described by Simon Willison, Wrapture takes the monkeypatching ideas from Dumpleton's earlier wrapt library and extends them to cover testing and tracing at the same time. It lets a developer wrap any function or method so that every call to it can be traced, or so its return value can be overridden, working as both an alternative to Python's unittest.mock and as a way to add tracing to a project that already exists. Wrapture ships with OpenTelemetry support and a configuration-only mechanism for instrumenting an existing Python project: a TOML block naming an [[observe]] target such as a class and its methods, paired with a [[sink]] that writes trace events to a file, for example as JSON lines. Dumpleton describes the underlying problem as one he has thought about for a long time: attaching observation to code you do not control, recording what flows through it, without disturbing the program being watched. Willison calls Wrapture still a very young project, just a few weeks old, but says it is off to a very promising start. Dumpleton also frames the release as his first attempt at a large, entirely agent-driven project. He writes that every line of code and documentation in Wrapture was written by an AI assistant working under his direction, and is explicit that this was not vibe coding: he says vibe coding is a one-shot prompt producing a pile of generated code that the person driving hopes works because they lack the knowledge to judge it, and that it has earned its bad reputation. By contrast, he says he engineered Wrapture carefully from the start, drawing on long experience in this corner of Python to know exactly what the result needed to be, with the AI serving as the means of producing that result rather than as the source of its design. In a companion post, "Unit testing with wrapture," Dumpleton shows the resulting testing patterns: binding to a method such as Gateway.charge to make it return a fixed stub value in a test, or to call the original method and then transform its result, for example rewriting a returned charge ID before an assertion runs against it.
Key facts
- Graham Dumpleton, creator of wrapt, mod_wsgi and New Relic's Python agent, has released Wrapture, a new Python library.
- Wrapture extends wrapt's monkeypatching approach to cover both testing (as an alternative to unittest.mock) and tracing of existing code, with OpenTelemetry support and a config-only tracing setup.
- Dumpleton says every line of code and documentation in Wrapture was written by an AI assistant under his direction, calling it his first large, entirely agent-driven project.
- He distinguishes this deliberate, carefully engineered approach from vibe coding, which he describes as one-shot prompting with no real judgment of the output.
- Willison describes Wrapture as just a few weeks old but off to a very promising start; a follow-up post, "Unit testing with wrapture," shows its testing patterns.
Why it matters
A developer with a long track record in Python instrumentation, the author of wrapt, mod_wsgi and New Relic's Python agent, has built a substantial new library entirely through AI-assisted coding and is willing to say so publicly. That makes Wrapture a data point in the argument over what disciplined, engineer-directed AI development looks like as distinct from vibe coding: the code was fully AI-written, but the design, direction and judgment were not delegated.
Who it affects
Python developers who write unit tests and want an alternative to unittest.mock, and anyone who needs to add tracing or observability to a codebase they cannot easily modify from the inside. It is also relevant to engineers and engineering leads weighing what a deliberately AI-driven, non-vibe-coded project looks like in practice.
How to use it
Wrapture centers on binding to a target class and method, then either returning a fixed value with .on_call.returns(...) for stubbing in a test, or transforming the original return value with .on_call.transforms_result(...). For tracing, a project can be instrumented purely through configuration: an [[observe]] block names the target (for example domain:Calculator) and the method names to watch, and a [[sink]] block sends trace events to an output such as a JSON lines file. OpenTelemetry support is included. The source gives no release date, version number or license for Wrapture.
How solid is it
The library is, in Willison's words, still a very young project, just a few weeks old, though he says it is off to a very promising start. Beyond that characterization, the source gives no installation instructions, repository link, or adoption figures to gauge how solid or widely used it is.
Risks and caveats
As an early-stage project only a few weeks old, Wrapture lacks a stated version, license, or release date, and the source does not say which AI assistant or model Dumpleton used, nor whether the library supports async code or which Python versions it requires. Anyone adopting it this early should expect the API and internals to still be settling.
“Every line of code and documentation in wrapture was written by an AI assistant working under my direction. I want to be upfront about that, and equally upfront about what it was not. This was not vibe coding, where a one-shot prompt produces a pile of generated code and the person driving hopes for the best because they lack the knowledge to judge what came back. Vibe coding has earned its bad reputation. I engineered wrapture carefully from the start. I have spent a long time in this particular corner of Python and knew exactly what the result needed to be, and the AI was the means of producing it rather than the source of the design.”
— Graham Dumpleton