Graham Dumpleton's wrapture package is a new monkey patching library. It provides tools for unit testing and observability, mirroring functionality similar to New Relic style tracing. Initial tutorials published since August 31st cover a range of use cases, including recording method calls as timelines and displaying them as trees. The package supports monkey patching attributes, dictionaries, and generators, alongside callables.
Key features include live tracing, zero-code tracing via TOML configuration, and instrumentation for various Python frameworks like Flask, aiohttp, Django, FastAPI, and others. Wrapture also offers tools for finding slow code by recording timing information, both individually and aggregated. Traces can be exported to OpenTelemetry.
Wrapture is currently in alpha software. Configuration and testing are possible without modifying Python code, using a TOML file. This approach simplifies the integration process, particularly for engineers managing complex systems. The package includes interactive workshops implemented as JupyterLab notebooks.