Don't sleep on wrapture

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

Why it matters

Python developers get a free alpha tool that can add unit-test mocking, call recording, timing analysis and OpenTelemetry tracing to live applications without touching any Python code, just a TOML config file.

Read this as

Wrapture is a free Python tool released on August 31st that can temporarily swap parts of a running program for testing or watching what the program does, a technique called monkey patching. It can record every function call, trace slow code, and send timing data to standard monitoring systems. Python programmers who build, test or debug software can use it, though it is still alpha software.

Graham Dumpleton, the creator of a popular Python web-hosting tool, has released wrapture, an open-source alpha library for instrumenting and testing Python applications. The main draw for teams is zero-code operation: tracing is configured in a TOML file rather than by editing code, lowering adoption risk. It ships with a companion package covering major Python frameworks and exports to OpenTelemetry, a common industry standard, so it could complement or compete with existing paid monitoring setups.

Wrapture is a monkey patching library supporting both unittest.mock-style test mocking and New Relic-style observability. It records call timelines as trees, supports phased behaviour across multiple calls, and can patch attributes, dictionaries and generators as well as callables. Zero-code tracing is configured via TOML, and the companion wrapture-instrumentation package instruments flask, django, fastapi, grpc, httpx, sqlalchemy and roughly 15 other libraries. Traces export to OpenTelemetry; it remains in alpha.

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 Graham Dumpleton OpenTelemetry Flask unittest.mock New Relic TOML

Was this summary useful?

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

Related reading

datasette-charts 0.5a0

Datasette Charts 0.5a0 adds calendar heatmaps, box plots and active-over-time charts, enabling richer data visualisation directly in the browser without extra libraries.