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

Uploaded Python 2 Python 3

py_spy-0.1.3-py2.py3-none-manylinux1_i686.whl (5.4 MB view details)

Uploaded Python 2 Python 3

py_spy-0.1.3-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.3-cp36-cp36m-win_amd64.whl (1.2 MB view details)

Uploaded CPython 3.6m Windows x86-64

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

Uploaded CPython 3.6m Windows x86

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

Uploaded CPython 3.5m Windows x86-64

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

Uploaded CPython 3.5m Windows x86

py_spy-0.1.3-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.3-py2.py3-none-manylinux1_x86_64.whl.

File metadata

  • Download URL: py_spy-0.1.3-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.3-py2.py3-none-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 f31c77a8fdf27b6744360917314aa7c3c92fc7645438537b178b837528e8fbf7
MD5 a1fa6f9b203b3280b87c962034003cba
BLAKE2b-256 ae3554352a63107b5820f644bb8a6ca61304d0d48d5c6ab037451a61c6e5c573

See more details on using hashes here.

File details

Details for the file py_spy-0.1.3-py2.py3-none-manylinux1_i686.whl.

File metadata

  • Download URL: py_spy-0.1.3-py2.py3-none-manylinux1_i686.whl
  • Upload date:
  • Size: 5.4 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.3-py2.py3-none-manylinux1_i686.whl
Algorithm Hash digest
SHA256 8aa0bb0936e95e4e67e485924861e144da44cd0d21504c0363272b9dced6cac3
MD5 b70f567460cf9ade1cb139f128dc2af2
BLAKE2b-256 242c9022eaad429fb0277ce820886f80ad28ed40c8bfc9b3a999b5c1662e703a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: py_spy-0.1.3-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.3-py2.py3-none-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 e1c34ea6a1218a2a6d24829d79954bc564d0c847e72d145586102373f52817f3
MD5 8dcacd273e73800911e275796aa84499
BLAKE2b-256 7c55110c83c2c00d8e27b968e428b016f6d4c650f31fc9def29f3f70355df368

See more details on using hashes here.

File details

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

File metadata

  • Download URL: py_spy-0.1.3-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.3-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 e7899ca27789ed345cffaf0dffa1cee5a0a7f5acfbd1a5770dbe2511d75461ba
MD5 04af80302504eab18def566da28310da
BLAKE2b-256 05e8ec72ed180b5e2e3941366b28ea5e88864abf356156eedf984a954c9b91ec

See more details on using hashes here.

File details

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

File metadata

  • Download URL: py_spy-0.1.3-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.3-cp36-cp36m-win32.whl
Algorithm Hash digest
SHA256 8439b6745a58c9a41678d8eb4dd8ae15a046e8da007676bd019f31b2d57f91ed
MD5 3e0ad1bd5f2d2969ab778bc0a091392b
BLAKE2b-256 5c1d4fae7a9df4a0e833bc9523a20b6b798f3741f823ce37ac937dcdbb92ee75

See more details on using hashes here.

File details

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

File metadata

  • Download URL: py_spy-0.1.3-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.3-cp35-cp35m-win_amd64.whl
Algorithm Hash digest
SHA256 a97c590556c427114b335d93e3faf99fd4232c9490ed197b470b5a95fff82fd0
MD5 e98b00cbd4d9243bb3fde865f69eb333
BLAKE2b-256 e36ba609fd4a9ab7b075d6c99608b8534f3a5205f7a9da09000a2f57549db705

See more details on using hashes here.

File details

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

File metadata

  • Download URL: py_spy-0.1.3-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.3-cp35-cp35m-win32.whl
Algorithm Hash digest
SHA256 3c128550d087c82c854ca8d3bace34f4e5bd5f1077deaf629919b55dfd3a153f
MD5 b6b8797461d8951c8aef79c2f5b512d1
BLAKE2b-256 276553fcfedeabdc2dd4ecfb4876a1a50e27324c3486d9c873dd2210d64f5454

See more details on using hashes here.

File details

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

File metadata

  • Download URL: py_spy-0.1.3-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.3-cp27-cp27m-win32.whl
Algorithm Hash digest
SHA256 5ab2f125743feb921bff942de66d84f7515212c6afc95c190286e7ba88a4adf9
MD5 597c5b606d239c656fc67f16b8f8be47
BLAKE2b-256 bef12117fdb89080264765789e4771f6b5b5ee15f30e59990d30fecfd6b00e90

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