skillfed

viztracer

A debugging and profiling tool that can trace and visualize python code execution

viztracer v1.1.1 1.7M downloads/30d#3,622 on PyPI7,720
Permissive license Apache-2.0 Active released

What it is and what it does

VizTracer is a low-overhead execution tracer that records function entry and exit events, then visualizes them in an interactive timeline UI powered by Perfetto. It works as a command-line tool (no code changes needed for basic tracing) or as an inline context manager for programmatic control. The tracer captures detailed timing information and renders it in a browser-based viewer that supports zooming, filtering, and flamegraph generation.

The tool is designed to handle concurrent code: it natively supports threading (Python 3.12+ without modification, earlier versions with native threading module), multiprocessing, subprocess, asyncio, and PyTorch profiling. It also supports remote attach to running processes and can log extra information like variable values, function arguments, and exceptions without modifying source code. The fact sheet indicates it is actively maintained, production-stable, and has no known security vulnerabilities.

Use it for:

  • Identify performance bottlenecks in CPU-bound Python code by visualizing which functions consume the most time
  • Debug multi-threaded or async applications by seeing how threads and coroutines interleave and where blocking occurs
  • Profile PyTorch model training to understand GPU event timing and native call overhead
  • Trace subprocess and multiprocessing workflows to understand inter-process communication and timing
  • Generate flamegraphs from trace data to quickly spot hot code paths in large applications

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

VizTracer traces Python code execution and generates interactive visualizations showing function calls, timing, and execution flow across threads, processes, and async code.

Yes. VizTracer is a mature, actively maintained profiler with no security issues, minimal dependencies, and broad platform support. It solves a real problem (understanding code execution flow and performance) with low overhead and a polished UI. The Apache-2.0 license is permissive. Install it if you need to profile or debug Python execution; the command-line interface requires no code changes for initial exploration.

Install

viztracer on PyPI

pip

pip install viztracer

uv

uv add viztracer

poetry

poetry add viztracer

Installing viztracer

Before you install

Medium install friction due to compiled wheels for multiple platforms and Python versions (3.10–3.14). Active maintenance with recent commits and stable production status. Single runtime dependency (objprint) keeps the dependency surface minimal.

License in practice

Apache-2.0 permissive license allows commercial and private use with minimal restrictions, making it suitable for most development and production environments.

Quickstart

pip install viztracer

# Command line: trace a script
viztracer my_script.py arg1 arg2

# Or inline in code:
from viztracer import VizTracer
tracer = VizTracer()
tracer.start()
# code to trace
tracer.stop()
tracer.save()

Requires Python 3.10 or later. Compiled wheels available for Linux, macOS, and Windows; source build may require a C compiler on unsupported platforms.

Verify before relying

  • Exact overhead percentage for typical real-world applications (description mentions 'below 1x' but measurement methodology unclear)
  • Whether orjson is automatically installed or only recommended as optional for faster JSON export

Package facts

License Apache-2.0 (permissive)
Python support supports the current Python release (>=3.10)
Install friction medium — platform-specific wheel
Runtime dependencies 1 — objprint
Maintenance actively maintained — 276 days since the last release
Last repo commit
First released
Downloads 1,716,360/month — #3,622 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: viztracer-1.1.1-cp310-cp310-macosx_11_0_arm64.whl; viztracer-1.1.1-cp310-cp310-macosx_11_0_x86_64.whl; viztracer-1.1.1-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl; viztracer-1.1.1-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl; viztracer-1.1.1-cp310-cp310-win32.whl; viztracer-1.1.1-cp310-cp310-win_amd64.whl; viztracer-1.1.1-cp311-cp311-macosx_11_0_arm64.whl; viztracer-1.1.1-cp311-cp311-macosx_11_0_x86_64.whl; viztracer-1.1.1-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl; viztracer-1.1.1-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl; viztracer-1.1.1-cp311-cp311-win32.whl; viztracer-1.1.1-cp311-cp311-win_amd64.whl; viztracer-1.1.1-cp312-cp312-macosx_11_0_arm64.whl; viztracer-1.1.1-cp312-cp312-macosx_11_0_x86_64.whl; viztracer-1.1.1-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl; viztracer-1.1.1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl; viztracer-1.1.1-cp312-cp312-win32.whl; viztracer-1.1.1-cp312-cp312-win_amd64.whl; viztracer-1.1.1-cp313-cp313-macosx_11_0_arm64.whl; viztracer-1.1.1-cp313-cp313-macosx_11_0_x86_64.whl

Development Status :: 5 - Production/StableIntended Audience :: DevelopersOperating System :: MacOSOperating System :: Microsoft :: WindowsOperating System :: POSIX :: LinuxProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: Free ThreadingProgramming Language :: Python :: Free Threading :: 3 - StableTopic :: Software Development :: Bug TrackingTopic :: Software Development :: Quality AssuranceTopic :: System :: Logging

Tags

python code profiler tracerexecution timeline visualizationfunction call tracingperformance debugging toollow-overhead profilerthread-aware tracerasync code profiler
profilingdebuggingperformance-analysis

More Quality Assurance packages