Introducing wrapture
Wrapture is a new Python library created by Graham Dumpleton that extends monkeypatching concepts to handle both testing and tracing simultaneously. It allows developers to wrap any function or method so that its access can be tracked or overridden to return different values.
The library serves as an alternative to unittest.mock while also enabling observability for existing codebases. It includes built-in OpenTelemetry support and features a configuration-based system that lets users add tracing to projects without modifying the original code.
Notably, every line of code and documentation in the project was produced by an AI assistant operating under the creator's direction. The author emphasizes that this was not unguided code generation, but rather a carefully engineered process where deep domain expertise guided the AI's output.