Skip to main content

A Sampling Profiler for Python

Project description

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

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

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

py_spy-0.1.0-py2.py3-none-manylinux1_x86_64.whl (5.7 MB view details)

Uploaded Python 2 Python 3

py_spy-0.1.0-py2.py3-none-macosx_10_7_x86_64.whl (3.0 MB view details)

Uploaded Python 2 Python 3 macOS 10.7+ x86-64

File details

Details for the file py_spy-0.1.0-py2.py3-none-manylinux1_x86_64.whl.

File metadata

  • Download URL: py_spy-0.1.0-py2.py3-none-manylinux1_x86_64.whl
  • Upload date:
  • Size: 5.7 MB
  • Tags: Python 2, Python 3
  • Uploaded using 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

File hashes

Hashes for py_spy-0.1.0-py2.py3-none-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 d539e7ad732dcd1f5e14bbeee61b9e1ce723dbfe729fedeb4455604efda6d5dd
MD5 4ecdeb4d80a85bfa32e835814dc689ba
BLAKE2b-256 5170e8bfeeac2c57f3af9988ca6d6d12cff3a9a1394e0d9a2c63f08555c0552f

See more details on using hashes here.

File details

Details for the file py_spy-0.1.0-py2.py3-none-macosx_10_7_x86_64.whl.

File metadata

  • Download URL: py_spy-0.1.0-py2.py3-none-macosx_10_7_x86_64.whl
  • Upload date:
  • Size: 3.0 MB
  • Tags: Python 2, Python 3, macOS 10.7+ x86-64
  • Uploaded using 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

File hashes

Hashes for py_spy-0.1.0-py2.py3-none-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 afcf0588d658b90dcabef989fc16ed38f6c9f2939cfca6772ded28c2ade0cb66
MD5 a2c671fcc07856ccb619c35ff94ed151
BLAKE2b-256 213a9960cd0e251bd156e78c009a7af26059d99f05aaeb6524249ebb35914401

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page