A low-overhead sampling profiler for Python programs that works without restarting or modifying code, written in Rust.
py-spy is a sampling profiler for Python that allows developers to analyze the performance of running programs without any code modifications. It solves the problem of debugging performance issues in production services by operating externally with minimal overhead. The tool generates visual profiles like flame graphs and live top views to identify bottlenecks.
Python developers and engineers who need to diagnose performance issues in live applications, especially in production environments where traditional profilers are too invasive.
Developers choose py-spy because it offers a safe, low-overhead way to profile Python code without restarting processes or altering source code. Its unique selling point is the ability to debug production systems with negligible performance impact, thanks to its Rust-based out-of-process architecture.
Sampling profiler for Python programs
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Profiles running Python programs without restarts or code changes, enabling safe use in production environments as emphasized in the README.
Written in Rust and operates out-of-process, ensuring low impact on the target application, which is crucial for production debugging.
Generates flame graphs, speedscope profiles, and raw data, offering multiple ways to visualize and analyze performance bottlenecks.
Can profile C/C++ extensions on supported platforms and capture data from child processes, useful for multiprocessing or gunicorn setups.
Lacks support for PyPy, 32-bit Windows, and USC2 Python 2, and native extension profiling is incomplete on some architectures (e.g., no macOS support for x86-64 native extensions).
Often requires root access or specific capabilities (like SYS_PTRACE in containers), and installation on systems like Alpine Linux needs manual workarounds, adding friction.
Heuristics for filtering idle threads can fail due to race conditions or OS limitations, potentially leading to inaccurate profiles in multi-threaded applications.