Tools Practical By Samson Tanimawo, PhD Published Oct 19, 2025 4 min read

py-spy for Python Performance

py-spy is a sampling profiler for Python.

Usage

py-spy is a sampling profiler for Python. Where cProfile requires modifying the application, py-spy attaches to running processes; the discipline is non-invasive.

What basic usage looks like:

Basic usage is fast. Engineers who debug Python performance benefit from learning py-spy.

When

py-spy is reached for during Python performance investigations. Slow processes, high-CPU processes, processes under load all are good candidates.

The when is straightforward. py-spy is the Python-specific reach for CPU investigation.

Alternatives

Beyond py-spy, other profilers exist. Each has trade-offs; the team picks the appropriate tool for the situation.

py-spy for Python perf is one of those tooling skills that pays off in Python performance investigations. Nova AI Ops integrates with application performance telemetry, surfaces patterns at scale, and complements local-tool profiling.