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; nothing is published to PyPI yet. 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 (the recording WSGI middleware installed on each application at construction), every view function beneath its request (observed as routes register, blueprints and MethodViews included), and the exception Flask catches on its way to a 500 noted on the request. none yet

The entry point name is the config's name; the table says what each instrumentation does in the current cut. 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 and imports only wrapture; everything that touches the target lives in hooks.py, reached by an import inside apply(). The class is registered in pyproject.toml under [project.entry-points."wrapture.instrumentation"], and gets its own test suite under tests/<category>_<target>/. 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.dev1

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.dev1
File Size Uploaded
wrapture_instrumentation-1.0.0.dev1.tar.gz 26.8 kB Details

Built distribution (wheel)

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

Total release size: 34.9 kB

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

Download URL wrapture_instrumentation-1.0.0.dev1.tar.gz
Size 26.8 kB
Tags Source
SHA-256 checksum
How to use checksums
d559f41134daa2f3fe8596ef6a2bc6a191ba68857c0f46e81673c42e65726929
BLAKE2b-256 checksum
How to use checksums
c0bed27f417e56ae2d2f07ad153a4af8561fde770c9f586d8d5e90ef5774cefd
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 Aug 24, 2026.

Transparency log

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

Download URL wrapture_instrumentation-1.0.0.dev1-py3-none-any.whl
Size 8.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5ab13eb793b4e07d790188c6752082e506b89c7dc2b8ef94d0e905c51113cf42
BLAKE2b-256 checksum
How to use checksums
36229071b2d52471b6961a629666e830946d5d476147fbc00d43da7b09303150
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 Aug 24, 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