Skip to main content

A Sampling Profiler for Python

Project description

Build Status Windows Build status

Py-Spy is a sampling profiler for Python programs. It lets you visualize what your Python program is spending time on without restarting the program or modifiying the code in any way. Py-Spy is extremely low overhead: it is written in Rust for speed and doesn’t pause or slow down the profiled Python program. This means Py-Spy is safe to use in production.

Py-Spy works on Linux, OSX and Windows, and supports profiling all recent versions of the CPython interpreter (versions 2.3-2.7 and 3.3-3.7).

Installation

Prebuilt binary wheels can be installed from PyPI with:

pip install py-spy

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.2-py2.py3-none-manylinux1_x86_64.whl (5.9 MB view details)

Uploaded Python 2 Python 3

py_spy-0.1.2-py2.py3-none-macosx_10_7_x86_64.whl (3.1 MB view details)

Uploaded Python 2 Python 3 macOS 10.7+ x86-64

py_spy-0.1.2-cp36-cp36m-win_amd64.whl (1.2 MB view details)

Uploaded CPython 3.6m Windows x86-64

py_spy-0.1.2-cp36-cp36m-win32.whl (1.1 MB view details)

Uploaded CPython 3.6m Windows x86

py_spy-0.1.2-cp35-cp35m-win_amd64.whl (1.2 MB view details)

Uploaded CPython 3.5m Windows x86-64

py_spy-0.1.2-cp35-cp35m-win32.whl (1.1 MB view details)

Uploaded CPython 3.5m Windows x86

py_spy-0.1.2-cp27-cp27m-win32.whl (1.1 MB view details)

Uploaded CPython 2.7m Windows x86

File details

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

File metadata

  • Download URL: py_spy-0.1.2-py2.py3-none-manylinux1_x86_64.whl
  • Upload date:
  • Size: 5.9 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.2-py2.py3-none-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 bccd75099d12c6ba14af28758f843353248b12a770c3f01d470ef4ac31540b23
MD5 dac8990e11dc05f4ff27a9697d97f0da
BLAKE2b-256 d7a74cff474ba333caf48834b764a5f1b54274f45a7e120da60f2b8b9f184e59

See more details on using hashes here.

File details

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

File metadata

  • Download URL: py_spy-0.1.2-py2.py3-none-macosx_10_7_x86_64.whl
  • Upload date:
  • Size: 3.1 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.2-py2.py3-none-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 ffc431bf4046df8d01c262e7526eee8c08c723cd9eeaa786f03791efb51170bc
MD5 323eedfbc33c45b807625a347eeb60ca
BLAKE2b-256 77fd3316b612072cc02d7840608c9d665ee178ce9840530163ba766b70dc5235

See more details on using hashes here.

File details

Details for the file py_spy-0.1.2-cp36-cp36m-win_amd64.whl.

File metadata

  • Download URL: py_spy-0.1.2-cp36-cp36m-win_amd64.whl
  • Upload date:
  • Size: 1.2 MB
  • Tags: CPython 3.6m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/2.7.15

File hashes

Hashes for py_spy-0.1.2-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 55759a59798089d39610a9e4d712ef67fc7cea5f4956f504080f2a80bcbee8e0
MD5 9a76482adc5138d6d00f88e9b0fe8b10
BLAKE2b-256 4d5498e606f96a4ed8096c07e7044c3fbb3a3a9e3b2bc59461a2acd0aa53af2b

See more details on using hashes here.

File details

Details for the file py_spy-0.1.2-cp36-cp36m-win32.whl.

File metadata

  • Download URL: py_spy-0.1.2-cp36-cp36m-win32.whl
  • Upload date:
  • Size: 1.1 MB
  • Tags: CPython 3.6m, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/2.7.15

File hashes

Hashes for py_spy-0.1.2-cp36-cp36m-win32.whl
Algorithm Hash digest
SHA256 b7ffdd8e67eb7e60644dcfd9bc5506489406821eb21294300530912b5e6417eb
MD5 b70464fb4ce214fbd0e250d37f662b57
BLAKE2b-256 25c6a013da8398113d2bfd7f99c3b43e28fc7d39a886e9b7fc591a4ddecf6d4d

See more details on using hashes here.

File details

Details for the file py_spy-0.1.2-cp35-cp35m-win_amd64.whl.

File metadata

  • Download URL: py_spy-0.1.2-cp35-cp35m-win_amd64.whl
  • Upload date:
  • Size: 1.2 MB
  • Tags: CPython 3.5m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/2.7.15

File hashes

Hashes for py_spy-0.1.2-cp35-cp35m-win_amd64.whl
Algorithm Hash digest
SHA256 c7737196b943b23fda093adf1435e90c39f43f955175768c755a854f6ccac434
MD5 55abda2e5edb03a4604fce856d0e6d6b
BLAKE2b-256 a46e0ca07c335d1c1935384c27656965faf92798d4751e96945c9dd7f36990a3

See more details on using hashes here.

File details

Details for the file py_spy-0.1.2-cp35-cp35m-win32.whl.

File metadata

  • Download URL: py_spy-0.1.2-cp35-cp35m-win32.whl
  • Upload date:
  • Size: 1.1 MB
  • Tags: CPython 3.5m, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/2.7.15

File hashes

Hashes for py_spy-0.1.2-cp35-cp35m-win32.whl
Algorithm Hash digest
SHA256 5ca34cef0fff5283df2cdb877f7d0ded16b66d0cf3edbaf056d4c02673499741
MD5 96f246493012415cf3127387614faf2a
BLAKE2b-256 fecf0ad51007e9232573e667a2a4a6fc756e6bdc226544aa1cfbb5372e1dbabb

See more details on using hashes here.

File details

Details for the file py_spy-0.1.2-cp27-cp27m-win32.whl.

File metadata

  • Download URL: py_spy-0.1.2-cp27-cp27m-win32.whl
  • Upload date:
  • Size: 1.1 MB
  • Tags: CPython 2.7m, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/2.7.15

File hashes

Hashes for py_spy-0.1.2-cp27-cp27m-win32.whl
Algorithm Hash digest
SHA256 bfd9866aaf6750052b6996af1ce277f1f8da860b6554ea2f3f22e07364a7a53b
MD5 98f4342d295c33701687f27565326efb
BLAKE2b-256 95db3b026da9db2d7e89f1f72c195183e8bfc55577b8018e6bca8ce0740f6910

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