Introducing wrapture
Simon Willison’s Weblog 3 days ago 39
Wrapture, a Python library by Graham Dumpleton, extends wrapt-style monkeypatching to support both tracing and function overriding for testing and observability. It provides an entirely configuration-based tracing example that uses OpenTelemetry with a capture set to "summary" for a target like "domain:Calculator". The result is a tool that can attach observations to code you don’t control and also act as an alternative to unittest.mock for stubbing and transforming results.