hiw3c AI 日报
Simon Willison 网页快照

不要睡在衣服上

原文标题 · Don't sleep on wrapture

Graham Dumpleton的新猴子修补包wrapper即将成为Python开发人员不可或缺的工具。我不知道为什么我很少看到有关它的嗡嗡声!自8月31日首次发布以来,Graham几乎每天都会发布新教程。以下是他迄今为止发表的所有内容:引入wrapper-一个新的猴子补丁库,同时提供测试和可观察性(想想New Relic风格的跟踪)。使用wrapper进行单元测试-如何将其用于与unittest

来源:Simon Willison · simonwillison.net

正文为英文,可一键机器翻译(仅首次需要等待)

Simon Willison’s Weblog

Graham Dumpleton's new monkey patching package wrapture is shaping up to be an indispensable tool for Python developers. I'm not sure why I've seen so little buzz about it!

Graham has been posting new tutorials for it almost daily since the initial release on August 31st. Here's everything he's published so far:

Introducing wrapture - a new monkey patching library that serves both testing and observability (think New Relic style tracing) at the same time.

Unit testing with wrapture - how to use it for the same kinds of thing as unittest.mock .

Recording calls with wrapture - recording method calls as timelines and processing and displaying them as trees.

Phased behaviour in wrapture - arranging patched methods to change behavior across multiple calls.

Beyond callables in wrapture - monkey patching attributes, dictionaries, generators.

Live tracing with wrapture - tracing a live application to see exactly how it works.

Zero-code tracing with wrapture - configuring tracing in a separate TOML file without modifying Python code at all.

Tracing Flask with wrapture - using the separate wrapture-instrumenation package to instrument a Flask application. That package also provides instrumentation for aiohttp.client , aiohttp.web , django , fastapi , flask , grpc , http.client , httpx , jinja2 , requests , sqlalchemy , sqlite3 , starlette , urllib.request , urllib3 , uvicorn , werkzeug.serving , wsgiref.simple_server , xmlrpc.client , xmlrpc.server .

Finding slow code with wrapture - wrapture's tools for recording timing information, both individually and aggregated across multiple calls.

OpenTelemetry export in wrapture - exporting traces to OpenTelemetry.

Graham also has a set of interactive workshops for wrapture, implemented as JupyterLab notebooks.

Wrapture is still alpha software but it's already very usable - especially given you can configure and try it out with a TOML file without modifying any Python code at all.

This feels like one of those Swiss Army Knife packages that, once mastered, will provide value against all sorts of problems for years to come.

Recent articles

OpenAI agents attacked RubyGems back in May - 12th September 2026

Some thoughts on the Navier–Stokes Millennium Prize Problem - 8th September 2026

The Pelican comparison grid for Astra is pretty interesting - 4th September 2026

This is a note by Simon Willison, posted on 11th September 2026 .

Monthly briefing

Sponsor me for $10/month and get a curated email digest of the month's most important LLM developments.