py-spy review
A focused, open-source CPU profiler for inspecting live Python processes with minimal overhead.
Reviewed by iTechGuides Editors · Editorial team · Updated Oct 2026
py-spy is an open-source command-line sampling profiler for Python programs. It attaches to running processes or launches programs for profiling without requiring code changes or process restarts. Its desktop deployment supports Windows, macOS, and Linux, with CPython support across those platforms and FreeBSD. The tool is aimed at developers who need to understand CPU usage, thread activity, or slow execution paths without modifying the application being profiled.
Its main strength is the breadth of inspection available from a sampling profiler. py-spy runs outside the profiled Python process with low overhead, then records results as interactive SVG flame graphs, speedscope files, or raw data. A live top view shows functions consuming time, while thread call-stack dumps expose activity across Python threads. GIL-focused filtering and thread activity inspection add useful detail for diagnosing contention. Local variables associated with stack frames can also be displayed, and native mode extends profiling to selected C, C++, and Cython extensions.
The tool is a focused choice rather than a broad profiling suite. Subprocess profiling includes child processes, which helps when work is distributed across launched processes, but the core scope remains Python CPU profiling through sampling. It does not provide verified memory profiling, so teams investigating allocation behavior or memory growth should choose a product designed for that purpose instead. py-spy fits developers who want an open-source, low-overhead view of running Python programs and prefer command-line workflows; it is less suitable when memory analysis or profiling modes beyond sampling are central requirements.
py-spy pros and cons
- Where it wins
- Profiles running Python programs without code changes or restarts
- Generates interactive flame graphs, speedscope files, and raw data
- Inspects threads, native extensions, subprocesses, and GIL activity
- Where it doesn't
- Does not provide verified memory profiling
- Uses sampling rather than broader profiling modes
- Primarily targets Python programs and Python execution paths
py-spy fact sheet, pricing and score →
Advertiser disclosure: iTechGuides is reader-supported. Vendors can pay for top positions in our rankings and for a place on other products' pages, and we may earn a commission when you click some links. Bought places stand at the number bought; this page and our disclosure say so. Paying vendors may get a fuller, more detailed review from our editors, and that review can change their score. How we rank.
Last updated · How we research and update