Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

wrapture-instrumentation

Instrumentation for common Python packages, applied through wrapture.

wrapture attaches bindings to arbitrary Python call sites without modifying the code being observed, and its config layer can switch on packaged instrumentation for a third-party package by name. This project is the collection of that packaged instrumentation: one wrapture.Instrumentation class per target package (Flask first, more to follow), each registered under the bare target name, so that tracing a framework is one config entry and no code.

Status: pre-alpha. The package is being built target by target against wrapture's alpha series, with development releases published to PyPI. Flask is the first target and covers its basics; see the table below.

Installation

$ pip install wrapture-instrumentation

Installing it brings wrapture and nothing else. No target package is a dependency: the instrumentation for a package you do not have is inert, and wrapture checks the installed version of each target against the range the instrumentation supports at apply time.

Using it

An [[instrument]] entry in wrapture.toml names a target:

[[instrument]]
name = "flask"

[[sink]]
type = "printer"

and the runner applies it before the application starts, so the patches are in place before the framework is imported:

$ python -m wrapture -m myapp

The same config works through autowrapt injection (AUTOWRAPT_BOOTSTRAP=wrapture python myapp.py) and, in a test, through wrapture.instrumentation("flask") scoping the instrumentation to a block. The ad-hoc tracing guide covers the config file itself.

To see what is installed, what each instrumentation supports in the current environment, and what settings it takes:

$ python -m wrapture.tools instrumentation --verbose

and to generate the [[instrument]] entries to paste into a config, every one disabled and every setting commented out at its default:

$ python -m wrapture.tools instrumentation --toml

Provided instrumentation

Target Supported versions Records Settings
flask Flask 3.x Every request as one tree, annotated with route and endpoint; every view observed and labelled by endpoint; template renders beneath their views; handled and unhandled failures noted on the request. ignore_paths, redact, lifecycle, handled_errors, templates
jinja2 Jinja2 3.x Every render traced in all its forms (sync, async, streamed), annotated with the template name; the loading and compile pipeline beneath it; context and output kept out of capture. loading
urllib Python 3.12+ (standard library) Every request through urllib.request as one external leaf carrying method, URL, host, port, path, query and status; the trace identity propagated in its headers; the query recorded with secrets masked, the body and response kept out of capture. leaf, propagate, redact

The entry point name is the config's name; the table summarizes each instrumentation, and the linked per-target README is its full user documentation: what records, what the events carry, the settings, and what is deliberately not traced. Settings, further choke points and wider version ranges are being added target by target.

Adding a target

Each target lives in its own subpackage under src/wrapture_instrumentation/, named <category>_<target>: framework_flask, external_requests, database_sqlite3. The category says what kind of thing the target is and, with it, which part of wrapture the instrumentation mostly uses:

  • framework_: web frameworks, and their extensions as compound names (framework_flask_restful).
  • external_: outbound HTTP and RPC clients and service SDKs.
  • database_: DB-API drivers and SQL toolkits.
  • datastore_: other stores and caches.
  • task_: task queues. messaging_: brokers and their clients.
  • server_: WSGI and ASGI servers. template_: template engines.

A new category is added when a target fits none of these. The directory name is internal; the entry point name, and so the name a config uses, is always the bare target.

The subpackage's __init__.py holds one wrapture.Instrumentation subclass, with one @wrapture.instrumentation_hook method per trigger module, and imports only wrapture; everything that touches the target lives in sibling submodules named for what they patch (app.py for flask.app), themselves importing only wrapture at top level. The class is registered in pyproject.toml under [project.entry-points."wrapture.instrumentation"], and gets its own test suite under tests/<category>_<target>/. Each subpackage also carries a README.md, its user documentation, rendered by GitHub when browsing the directory and linked from the table above; the module docstrings stay the implementation commentary. The instrumentation packages page of the wrapture documentation is the full contract; TESTING.md here covers the tests.

License

BSD-2-Clause, as wrapture.

Release files for wrapture-instrumentation 1.0.0.dev5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for wrapture-instrumentation 1.0.0.dev5
File Size Uploaded
wrapture_instrumentation-1.0.0.dev5.tar.gz 62.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for wrapture-instrumentation 1.0.0.dev5
File Interpreter ABI Platform
wrapture_instrumentation-1.0.0.dev5-py3-none-any.whl Python 3 none any Details

Total release size: 93.3 kB

Release files / wrapture_instrumentation-1.0.0.dev5.tar.gz

Download URL wrapture_instrumentation-1.0.0.dev5.tar.gz
Size 62.0 kB
Tags Source
SHA-256 checksum
How to use checksums
1a86e514028ee12ceb7f5608630a362011b3b4340496085f7ddb4aa8c3d2188f
BLAKE2b-256 checksum
How to use checksums
1145fcf8d0378c6c3d901ab7e0538aca2dafe5d5656ed664f1cdcb6b53d93a16
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 1, 2026.

Transparency log

Release files / wrapture_instrumentation-1.0.0.dev5-py3-none-any.whl

Download URL wrapture_instrumentation-1.0.0.dev5-py3-none-any.whl
Size 31.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e41aec6095b71c0ccd50bca4dca4224de85de9a502ccc1e7f10d773173968b04
BLAKE2b-256 checksum
How to use checksums
f01d280cfeaf505dde4e3cb2d5146ebddf880c5df86ca7eddaf99796be228a96
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 1, 2026.

Transparency log
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page