Skip to main content

A simple cli-based profiler for Python

Project description


An early look at a simple Python profiler, written in Python. Get started by typing pip install simple_python_profiler.


A profiler that times every function call and reports back the top 100 slowest functions.

logs every function call means it's non-sampling, hence resource-intensive. If that's unsuitable, check out something like py-spy.



from simple_python_profiler import Profiler
if __name__ == '__main__':
    with Profiler():

This will decorate all your top-level functions in your modules. System (built-in) and pip-installed packages (those that go in dist-packages) are excluded.

Since the default behaviour is to not include nested functions, you can profile your nested functions too as follows:

from simple_python_profiler import profile_recursive


def top_level_function():

    def inner_function():
        print('in inner fn')

This recursive feature relies on the codetransformer dependency. However, it has a few bugs in recent versions of Python. If you encounter runtime exceptions with simple_python_profiler, use the second, non-recursive decorator:

from simple_python_profiler import profile


def top_level_function():

    def inner_function():
        print('in inner fn')

Releasing on PyPI

  • pipenv shell
  • flit build
  • flit publish

Enter password when prompted.


  • option to include system packages

Released under the MIT licence. See file named LICENCE for details.

Project details

Download files

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

Files for simple_python_profiler, version 0.2
Filename, size File type Python version Upload date Hashes
Filename, size simple_python_profiler-0.2-py2.py3-none-any.whl (5.3 kB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size simple_python_profiler-0.2.tar.gz (7.9 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page