py-spy
py-spy is a fast sampling profiler for Python programs. py-spy lets you visualize what your Python program is doing without restarting the program or modifying the code in any way. py-spy is low overhead and won’t pause or slow your Python program down - meaning that it is safe to use in production.
To install:
pip install py-spy
py-spy supports Python versions 2.3+ and 3.3+ on Linux, OSX and Windows.
Usage
py-spy works from the command line, and takes either the PID of the program you want to sample from, or the command line of the python program you want to run:
py-spy --pid 12345
# OR
py-spy -- python myprogram.py
The default visualization is a top-like live view of your python program:
console viewer demo
There is also support for generating flame graphs from the running process:
py-spy --flame profile.svg --pid 12345
# OR
py-spy --flame profile.svg -- python myprogram.py
Which will generate a SVG file looking like:
flame graph
Credits
py-spy is heavily inspired by Julia Evans excellent work on rbspy. In particular the code to generate the flamegraphs is taken directly from rbspy, and this project use several crates (read-process-memory and proc-maps) that were spun off from rbspy.
Metadata
Release files for py-spy 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| py_spy-0.1.0-py2.py3-none-manylinux1_x86_64.whl | Python 3, Python 2 | none | Linux glibc 2.5+ x86-64 | Details |
| py_spy-0.1.0-py2.py3-none-macosx_10_7_x86_64.whl | Python 2, Python 3 | none | macOS 10.7+ x86-64 | Details |
Total release size: 8.7 MB
Release files / py_spy-0.1.0-py2.py3-none-manylinux1_x86_64.whl
| Download URL | py_spy-0.1.0-py2.py3-none-manylinux1_x86_64.whl |
|---|---|
| Size | 5.7 MB |
| Tags | Linux glibc 2.5+ x86-64 Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
d539e7ad732dcd1f5e14bbeee61b9e1ce723dbfe729fedeb4455604efda6d5dd
|
|
BLAKE2b-256 checksum How to use checksums |
5170e8bfeeac2c57f3af9988ca6d6d12cff3a9a1394e0d9a2c63f08555c0552f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/36.5.0.post20170921 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.6.3
|
Release files / py_spy-0.1.0-py2.py3-none-macosx_10_7_x86_64.whl
| Download URL | py_spy-0.1.0-py2.py3-none-macosx_10_7_x86_64.whl |
|---|---|
| Size | 3.0 MB |
| Tags | Python 2 Python 3 macOS 10.7+ x86-64 |
|
SHA-256 checksum How to use checksums |
afcf0588d658b90dcabef989fc16ed38f6c9f2939cfca6772ded28c2ade0cb66
|
|
BLAKE2b-256 checksum How to use checksums |
213a9960cd0e251bd156e78c009a7af26059d99f05aaeb6524249ebb35914401
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/36.5.0.post20170921 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.6.3
|