Skip to main content

A set of debugging decorators

Project description


This is a simple set of utilities which makes it easier to debug Python objects. Pydebug respects Django's config. It checks if the decorator is running within a Django project and DEBUG is set to True. If it's set to False, it simply returns the function.


You can install by cloning this repository and running pip install . within this directory, or you can install through Pypi, by running pip install python-pydebug.


Although Pydebug uses Python's standard library, it tried to import Django to make sure you are not within a Django project.

Library Defaults
Cython -
Line-profiler -

Line-profiler requires Cython to work, if IPDB is not found, it fallsback to Python's standard PBD library.

NOTE: At the moment, it is not possible to add rkern/line_profiler as a requirements due to their install process. Check their README for installation instructions.



from pydebug import PDBDebugger

def hello_world(a, b):
    x = a + b
    return (a, b)

You may tell PDBdebugger to drop a IPDB shell only when an error occurs

from pydebug import PDBDebugger

def hello_world(a, b):
    x = a + b
    return (a, b)


You may disassemble a Python function by using the Disassembledebug decorator.

from pydebug import Disassembledebug

def hello_world(a, b):
    x = a + b
    return (a, b)


Profilerdebug uses Python's default cProfile library.

from pydebug import ProfilerDebug

def hello_world(a, b):
    x = a + b
    return (a, b)


LineProfilerDebug requires line-profile library to work, which also requires Cython.

from pydebug import LineProfilerDebug

def hello_world(a, b):
    x = a + b
    return (a, b)


ObjectInfoDebug prints the arguments which were passed to the function, the performace counter (in minutes), the process time (in minutes) and the returned objects by the function.

from pydebug import ObjectInfoDebug

def hello_world(a, b):
    x = a + b
    return (a, b)


  1. Allow developer to use multiple decorators instead of one decorating the other
  2. Show better profile metrics
  3. Plot metrics to an image

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 python-pydebug, version 0.6
Filename, size File type Python version Upload date Hashes
Filename, size python-pydebug-0.6.tar.gz (4.8 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