tracypy
A lightweight bridge from Python's sys.monitoring
(PEP 669) to the Tracy profiler, as a plain-C
extension module. Every Python function call becomes a Tracy zone, so you can see
your program's call tree and timing in the Tracy viewer.
How it works
sys.monitoring delivers per-frame events; tracypy turns each frame's execution
span into a Tracy zone. Entry events (PY_START / PY_RESUME / PY_THROW) begin a
zone and exit events (PY_RETURN / PY_YIELD / PY_UNWIND) end it, pushed/popped on
a per-thread stack. The callbacks are fast C functions; registration is the only
part done in Python. Tracy is compiled in on-demand mode, so enabling tracypy is
essentially free until a Tracy viewer connects.
The extension is built free-threading-ready (Py_MOD_GIL_NOT_USED), so it works on
the free-threaded (no-GIL) builds of CPython too. Only Python function calls become
zones — work inside C builtins or extension modules doesn't show up as its own zone.
Each thread's zone stack is released when the process exits rather than when the thread
does, so profiling a process that spawns unbounded short-lived threads grows memory
slowly over time; for ordinary worker pools this is a non-issue.
Install
pip install tracypy # or: uv pip install tracypy
Prebuilt wheels are published for CPython 3.13 and 3.14 (including the free-threaded 3.14t build) on Linux, macOS, and Windows, with the Tracy client statically linked — no toolchain or submodule needed. There is no source distribution, so on a platform or Python without a matching wheel, install from a Git checkout (below) instead.
From source
Building needs Python ≥ 3.13, a C/C++ toolchain, and CMake. The Tracy client is vendored as a git submodule, so clone recursively (or init the submodule), then install:
git submodule update --init # if you didn't clone with --recurse-submodules
uv pip install . # or: pip install .
Usage
import tracypy
with tracypy.profile():
my_workload()
Or run a script/module under the profiler without editing it:
python -m tracypy my_script.py [args...]
python -m tracypy -m my.module [args...]
profile() forwards its tool_id / name arguments to enable(). The low-level
API is tracypy.enable(tool_id=PROFILER_ID, name="tracypy"), tracypy.disable(),
and tracypy.is_enabled(). tracypy.is_connected() reports whether a Tracy
viewer is currently attached — useful since on-demand capture records nothing
until one connects.
A runnable demo lives in examples/demo.py — connect a viewer,
then:
python -m tracypy examples/demo.py
Frames
Tracy frames delimit recurring units of work, so you can see per-unit timing statistics (min/max/avg, a frame-time graph) on top of the zone call tree. For web apps, for instance, a natural fit is "one frame per request":
import tracypy
# Discontinuous frame: an explicit span with a name of its own timeline.
with tracypy.frame("request"):
handle(request)
For a Django app, drop in a middleware:
import tracypy
class TracyFrameMiddleware:
def __init__(self, get_response):
self.get_response = get_response
def __call__(self, request):
with tracypy.frame("request"):
return self.get_response(request)
There's also a continuous-frame boundary marker, for the classic game-loop style where every tick is one frame:
tracypy.frame_mark() # default frame boundary
tracypy.frame_mark("render") # a named continuous frame
and the bare discontinuous primitives,
tracypy.frame_mark_start(name)tracypy.frame_mark_end(name)
if the context manager doesn't fit.
Frame marks are independent of zone capture — they work whether or not
enable() is on, and are inert until a viewer connects.
Viewing a trace
Download or build the Tracy profiler UI
and Connect to localhost before (or while) your program runs.
Because Tracy runs on-demand, nothing is captured until you connect.
tracypy vendors the Tracy client v0.13.1, so connect with a matching Tracy 0.13.x viewer — the network protocol is versioned, and a mismatched viewer won't connect.
On a clean exit tracypy flushes the buffered trace to a connected viewer
automatically (via an atexit hook), so even short scripts don't lose their
tail — just keep the viewer connected until the run finishes.
Release files for tracypy 0.13.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| tracypy-0.13.1.1-cp314-cp314t-win_amd64.whl | CPython 3.14 | CPython 3.14 free-threading | Windows x86-64 | Details |
| tracypy-0.13.1.1-cp314-cp314t-win32.whl | CPython 3.14 | CPython 3.14 free-threading | Windows x86-32 | Details |
| tracypy-0.13.1.1-cp314-cp314t-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl | CPython 3.14 | CPython 3.14 free-threading | Linux glibc 2.24+ x86-64, Linux glibc 2.28+ x86-64 | Details |
| tracypy-0.13.1.1-cp314-cp314t-macosx_11_0_arm64.whl | CPython 3.14 | CPython 3.14 free-threading | macOS 11.0+ ARM64 | Details |
| tracypy-0.13.1.1-cp314-cp314-win_amd64.whl | CPython 3.14 | CPython 3.14 | Windows x86-64 | Details |
| tracypy-0.13.1.1-cp314-cp314-win32.whl | CPython 3.14 | CPython 3.14 | Windows x86-32 | Details |
| tracypy-0.13.1.1-cp314-cp314-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl | CPython 3.14 | CPython 3.14 | Linux glibc 2.24+ x86-64, Linux glibc 2.28+ x86-64 | Details |
| tracypy-0.13.1.1-cp314-cp314-macosx_11_0_arm64.whl | CPython 3.14 | CPython 3.14 | macOS 11.0+ ARM64 | Details |
| tracypy-0.13.1.1-cp313-cp313-win_amd64.whl | CPython 3.13 | CPython 3.13 | Windows x86-64 | Details |
| tracypy-0.13.1.1-cp313-cp313-win32.whl | CPython 3.13 | CPython 3.13 | Windows x86-32 | Details |
| tracypy-0.13.1.1-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl | CPython 3.13 | CPython 3.13 | Linux glibc 2.24+ x86-64, Linux glibc 2.28+ x86-64 | Details |
| tracypy-0.13.1.1-cp313-cp313-macosx_11_0_arm64.whl | CPython 3.13 | CPython 3.13 | macOS 11.0+ ARM64 | Details |
Total release size: 2.5 MB
Release files / tracypy-0.13.1.1-cp314-cp314t-win_amd64.whl
| Download URL | tracypy-0.13.1.1-cp314-cp314t-win_amd64.whl |
|---|---|
| Size | 257.8 kB |
| Tags | CPython 3.14 CPython 3.14 free-threading Windows x86-64 |
|
SHA-256 checksum How to use checksums |
574b1ffd7a9fc7c713cc1b26b25a6f4a9195d3af7e68b0e5ada83002b28b7f83
|
|
BLAKE2b-256 checksum How to use checksums |
df7b41dceb77b0079980041a3b9e6e456ba1bfe53957b9d0d59f3502fd056b66
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
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 Jun 29, 2026.
Transparency logRelease files / tracypy-0.13.1.1-cp314-cp314t-win32.whl
| Download URL | tracypy-0.13.1.1-cp314-cp314t-win32.whl |
|---|---|
| Size | 253.9 kB |
| Tags | CPython 3.14 CPython 3.14 free-threading Windows x86-32 |
|
SHA-256 checksum How to use checksums |
bce2802ed281ad2181a46a32b44445d9a4b84332f1aca55cd92487559ad67512
|
|
BLAKE2b-256 checksum How to use checksums |
8e1ea994cbc8b2266aef3faa12ca55cec52e2dc74974f299f5a60c2a6dcf08b5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
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 Jun 29, 2026.
Transparency logRelease files / tracypy-0.13.1.1-cp314-cp314t-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
| Download URL | tracypy-0.13.1.1-cp314-cp314t-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 212.7 kB |
| Tags | CPython 3.14 CPython 3.14 free-threading Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
e771a63458df25a6fd183a28c433e711b277e33568c27f393e2922b431cf2f0f
|
|
BLAKE2b-256 checksum How to use checksums |
b9c0d7290466307a71252ffc368991e5af4705dff1f48b1612add40da6afce01
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
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 Jun 29, 2026.
Transparency logRelease files / tracypy-0.13.1.1-cp314-cp314t-macosx_11_0_arm64.whl
| Download URL | tracypy-0.13.1.1-cp314-cp314t-macosx_11_0_arm64.whl |
|---|---|
| Size | 130.6 kB |
| Tags | CPython 3.14 CPython 3.14 free-threading macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
2a75f8d12bbae8d6ccaa829adb84118536a4bb0d38564ba7e30d5beb95755638
|
|
BLAKE2b-256 checksum How to use checksums |
96aabeff6a1efe949cd985629a745e32e4dad837bb7cfc8269eba5e2ffcd0a53
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
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 Jun 29, 2026.
Transparency logRelease files / tracypy-0.13.1.1-cp314-cp314-win_amd64.whl
| Download URL | tracypy-0.13.1.1-cp314-cp314-win_amd64.whl |
|---|---|
| Size | 257.7 kB |
| Tags | CPython 3.14 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
520f4fb942fe328838dbbe30933dac8a04fb1e624ef91ea4cdc6bcf64dc11855
|
|
BLAKE2b-256 checksum How to use checksums |
688a1f30d8abfae9adcefb50a1d47f813ffad7bbcca2a4361c56f0f13b2dcac4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
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 Jun 29, 2026.
Transparency logRelease files / tracypy-0.13.1.1-cp314-cp314-win32.whl
| Download URL | tracypy-0.13.1.1-cp314-cp314-win32.whl |
|---|---|
| Size | 253.8 kB |
| Tags | CPython 3.14 Windows x86-32 |
|
SHA-256 checksum How to use checksums |
174c7c0c141a2e76eaa7e6105ad0b6d1b4ef06faa730d43d74de6d36110d7a1b
|
|
BLAKE2b-256 checksum How to use checksums |
129d3e9c39f6bea3a2fbc5bfe5ca2714436071bf0dc8cf1f063431d0669d8450
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
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 Jun 29, 2026.
Transparency logRelease files / tracypy-0.13.1.1-cp314-cp314-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
| Download URL | tracypy-0.13.1.1-cp314-cp314-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 212.6 kB |
| Tags | CPython 3.14 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
80dac42b9f3556e8db4ba82a2687556450f1776b0d0bd0e9ac8b05a0de9a56cf
|
|
BLAKE2b-256 checksum How to use checksums |
38dfaa13dd9a46296de35648c39121657482286620390b1cddf2961a14bca3f9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
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 Jun 29, 2026.
Transparency logRelease files / tracypy-0.13.1.1-cp314-cp314-macosx_11_0_arm64.whl
| Download URL | tracypy-0.13.1.1-cp314-cp314-macosx_11_0_arm64.whl |
|---|---|
| Size | 130.4 kB |
| Tags | CPython 3.14 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
28d5c37cbc311fc1ae6e215f17bda875b0cd94bf1aa3ba17bcf877b2ab1726f7
|
|
BLAKE2b-256 checksum How to use checksums |
6edd8b51109874379aa943d8ebfb17914fe22028e777ee6b035764f066886c72
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
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 Jun 29, 2026.
Transparency logRelease files / tracypy-0.13.1.1-cp313-cp313-win_amd64.whl
| Download URL | tracypy-0.13.1.1-cp313-cp313-win_amd64.whl |
|---|---|
| Size | 249.4 kB |
| Tags | CPython 3.13 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
ba150b957c511df5f4473300b16535c2bc30014e787ca9273b8a27197c8d34cc
|
|
BLAKE2b-256 checksum How to use checksums |
c5084df9b45ed5ce0b018fbf3079a3e7ded26b33ed13eba19448d4b8c36cb6a5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
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 Jun 29, 2026.
Transparency logRelease files / tracypy-0.13.1.1-cp313-cp313-win32.whl
| Download URL | tracypy-0.13.1.1-cp313-cp313-win32.whl |
|---|---|
| Size | 247.0 kB |
| Tags | CPython 3.13 Windows x86-32 |
|
SHA-256 checksum How to use checksums |
ca42152b3600cf3b37dd72fffdc4f818ebb0ae80271c287d3946cf444ca2e31e
|
|
BLAKE2b-256 checksum How to use checksums |
fa2ddf15b6958b0749fe588af4f2f0696a6b04b72a66b1e78485fc5ff833e7ab
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
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 Jun 29, 2026.
Transparency logRelease files / tracypy-0.13.1.1-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
| Download URL | tracypy-0.13.1.1-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 212.6 kB |
| Tags | CPython 3.13 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
2000570746605b63fca75cfe1b7786ca90795c6da89045eb5b068b3745e88080
|
|
BLAKE2b-256 checksum How to use checksums |
96b378ddcc1a14b00c2f7fa7ccf5ea9788a11d74d2511b91d2cd9b24ca20d7fc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
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 Jun 29, 2026.
Transparency logRelease files / tracypy-0.13.1.1-cp313-cp313-macosx_11_0_arm64.whl
| Download URL | tracypy-0.13.1.1-cp313-cp313-macosx_11_0_arm64.whl |
|---|---|
| Size | 130.4 kB |
| Tags | CPython 3.13 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
66d25dc1793ef301e910d1236d97bbb7240a78698c347c05bfa6b6544d9ad04f
|
|
BLAKE2b-256 checksum How to use checksums |
a8918ab1db0cd0e6f85ee4e62e9ca0e4dc7c4278fd039722418b0c211df641e2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
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 Jun 29, 2026.
Transparency log