Skip to main content

Sampling Python Profiler

Project description

SPyProf

Sampling line-by-line Python profiler.

Installation

pip install https://github.com/yuriiz/spyprof

Usage

Import spyprof module at startup:

import spyprof

Profiling reports will be written to spyprof directory periodically every 10 seconds and at application exit.

Profiling report measured with ITIMER_REAL timer will be written to spyprof/real.html.

Profiling report measured with ITIMER_PROF timer will be written to spyprof/prof.html.

Example

Running following code:

import math
from time import sleep

import spyprof


def foo():
    """
    CPU time consuming code.
    """
    for i in range(10**8):
        math.sqrt(i)
        math.sqrt(i)
        pass


def bar():
    """
    Real time consuming code.
    """
    sleep(10)


if __name__ == "__main__":
    foo()
    bar()

Will result in the following reports:

real.html prof.html
Screenshot 2025-09-08 at 21-13-57 Screenshot 2025-09-08 at 21-14-04

Project details


Download files

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

Source Distribution

spyprof-0.0.2.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

spyprof-0.0.2-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

Details for the file spyprof-0.0.2.tar.gz.

File metadata

  • Download URL: spyprof-0.0.2.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for spyprof-0.0.2.tar.gz
Algorithm Hash digest
SHA256 895ae517556175cfc665da8115cb15b87650a0489a9be80c9a2875ccbc1bb7e8
MD5 6f5c8b5a3f3a4cfdf027c9ec0acff1c7
BLAKE2b-256 4f442dc5b4206d2d85a761aacd30fc5261b0ec2005ff988eadfedab030fed77f

See more details on using hashes here.

Provenance

The following attestation bundles were made for spyprof-0.0.2.tar.gz:

Publisher: python-publish.yml on yuriiz/spyprof

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file spyprof-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: spyprof-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 4.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for spyprof-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 7ed30766f5066e14d494b73fd5a305f1a01f805f3b33bc57dd4bdb53032f4bcc
MD5 bdd3e7593f41fc9314725cae38342d99
BLAKE2b-256 0d8ee5fc285e6ce3ba1ec416f067a73b460a581ed18c2902893b6f24e705b464

See more details on using hashes here.

Provenance

The following attestation bundles were made for spyprof-0.0.2-py3-none-any.whl:

Publisher: python-publish.yml on yuriiz/spyprof

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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