py-spy
Decision gist · record as of 2026-08-14
Yes. py-spy is a mature, actively maintained tool (15433 GitHub stars, recent commits, no vulnerabilities) with permissive licensing and broad platform support. Medium install friction is acceptable for a compiled profiler. It solves a real problem—production-safe profiling without code changes—that most in-process profilers cannot. Install if you need to profile running Python workloads or generate performance visualizations.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- On Linux and macOS, profiling an existing process typically requires root/sudo access due to OS security restrictions; profiling a process py-spy launches itself does not.
- Windows and FreeBSD support varies by architecture.
- Medium install friction due to compiled binary wheels for multiple platforms (Linux x86/ARM, macOS Intel/ARM, Windows).
License · maintenance · safety
permissive license (permissive) — Permissive license (MIT) means you can use, modify, and distribute py-spy with minimal restrictions in both open-source and commercial projects.
last release 2026-04-24 (112 days) · last repo commit 2026-08-14 · 15,433 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 25,506,961 downloads/mo, #902 on PyPI
Alternatives
Verify before relying
pip install py-spy
# Profile a running process by PID:
py-spy record -o profile.svg --pid 12345
# Or launch and profile a new Python program:
py-spy record -o profile.svg -- python myprogram.py
# View live profiling:
py-spy top --pid 12345- Exact Python version support range (description mentions 2.3-2.7 and 3.3-3.14 but requires_python field is unspecified)
- Whether native extension profiling (C/C++/Cython) is available on all supported platforms or only Linux/Windows x86-64 and ARM variants
What it is and what it does
py-spy is a command-line sampling profiler written in Rust that runs outside the target Python process to measure CPU time spent in each function. It attaches to running Python programs by reading their memory directly (via OS system calls), extracting the call stack without modifying or restarting the program. This out-of-process design makes it safe for production use with minimal overhead.
The tool provides three main modes: record (saves profiles to SVG flame graphs or other formats), top (live view of hottest functions like Unix top), and dump (shows current call stacks for all threads). It works across Linux, macOS, Windows, and FreeBSD, supports profiling native C/C++ extensions on some platforms, can follow subprocesses, and includes local variable inspection. No runtime dependencies are required—py-spy is a standalone binary.
Use it for
- Debug performance bottlenecks in production Python services without restarting or modifying code.
- Generate flame graphs to visualize where a Python program spends CPU time during execution.
- Monitor live function call activity in long-running processes using the top command.
- Inspect call stacks and local variables of hung or slow Python threads for troubleshooting.
- Profile Python applications using multiprocessing or gunicorn worker pools with subprocess tracking.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
py-spy is a mature, actively maintained tool (15433 GitHub stars, recent commits, no vulnerabilities) with permissive licensing and broad platform support. Medium install friction is acceptable for a compiled profiler. It solves a real problem—production-safe profiling without code changes—that most in-process profilers cannot. Install if you need to profile running Python workloads or generate performance visualizations.
Install
py-spy on PyPI
Before you install
Medium install friction due to compiled binary wheels for multiple platforms (Linux x86/ARM, macOS Intel/ARM, Windows). Repository is active with recent commits and no archived status, suggesting ongoing maintenance.
On Linux and macOS, profiling an existing process typically requires root/sudo access due to OS security restrictions; profiling a process py-spy launches itself does not. Windows and FreeBSD support varies by architecture.
License in practice
Permissive license (MIT) means you can use, modify, and distribute py-spy with minimal restrictions in both open-source and commercial projects.
Quickstart
pip install py-spy
# Profile a running process by PID:
py-spy record -o profile.svg --pid 12345
# Or launch and profile a new Python program:
py-spy record -o profile.svg -- python myprogram.py
# View live profiling:
py-spy top --pid 12345
Verify before relying
- Exact Python version support range (description mentions 2.3-2.7 and 3.3-3.14 but requires_python field is unspecified)
- Whether native extension profiling (C/C++/Cython) is available on all supported platforms or only Linux/Windows x86-64 and ARM variants
Package facts
| License | permissive license permissive |
| Python support | Not specified |
| Install friction | Medium. Platform-specific wheel |
| Runtime dependencies | None |
| Maintenance | Actively maintained 112 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 25,506,961 / month, #902 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 2Programming Language :: Python :: 3Topic :: Software Development :: LibrariesTopic :: Utilities |
Evidence: py_spy-0.4.2-py2.py3-none-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl; py_spy-0.4.2-py2.py3-none-macosx_11_0_arm64.whl; py_spy-0.4.2-py2.py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl; py_spy-0.4.2-py2.py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl; py_spy-0.4.2-py2.py3-none-manylinux_2_5_i686.manylinux1_i686.whl; py_spy-0.4.2-py2.py3-none-manylinux_2_5_x86_64.manylinux1_x86_64.whl; py_spy-0.4.2-py2.py3-none-win_amd64.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “profile running python process”
- py-spypy-spy is a sampling profiler that attaches to running Python…
- memory-profilerProfiles memory consumption line-by-line in Python functions and…
- ps-memps_mem reports the actual core memory usage (private plus shared) for…
Give your agent the search over MCP, or paste the wish link into any chat.
More Libraries packages
urllib3 is an HTTP client library that provides thread-safe connection pooling, SSL/TLS verification, multipart file uploads, request retries, compression support, and proxy handling for Python applications.
Requests is a Python HTTP library that simplifies sending HTTP/1.1 requests with automatic handling of headers, authentication, cookies, and response parsing.
Pluggy provides a plugin system that lets you define hook specifications and register implementations to be called in sequence, enabling extensible Python applications without tight coupling.
Install it if you're building an extensible application or framework.
Provides parsing, arithmetic, and recurrence rule computation for dates and times, with timezone support and iCalendar RFC compliance.
Install it if you need to parse flexible date strings, compute relative dates, handle timezones, or work with recurrence rules—it's the de facto choice for these tasks.
Six provides utility functions to write Python code that runs on both Python 2.7 and Python 3.3+, smoothing over language differences between the two versions.
pytest is a testing framework that lets you write test functions using plain assert statements and automatically discovers and runs them, with detailed failure reporting.
See also austin-dist · gilknocker · pyroscope-io · pystack · setproctitle · pyinstrument · memory-profiler · yappi · snakeviz · memray