Skip to main content

PyDebug

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.

Installing

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.

Requirements

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 -
IPDB PDB
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.

Usage

PDBDebugger

from pydebug import PDBDebugger

@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

@PDBDebugger(on_error=True)
def hello_world(a, b):
    x = a + b
    return (a, b)

DisassembleDebug

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

from pydebug import Disassembledebug

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

Profilerdebug

Profilerdebug uses Python's default cProfile library.

from pydebug import ProfilerDebug

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

LineProfilerDebug

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

from pydebug import LineProfilerDebug

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

ObjectInfoDebug

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

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

TODOs

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

Metadata

Release files for python-pydebug 0.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for python-pydebug 0.6
File Size Uploaded Provenance
python-pydebug-0.6.tar.gz 4.8 kB Without provenance Details

Release files / python-pydebug-0.6.tar.gz

Download URL python-pydebug-0.6.tar.gz
Size 4.8 kB
Tags Source
SHA-256 checksum
How to use checksums
9e9950f031bcaf3130aa911bab3d8bf8db44c214c0744d1f52e61f29dca24634
BLAKE2b-256 checksum
How to use checksums
fc312a9e919c431d5b7254cfda83e945dc70baeb934dd067fab21af55b820f4e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.0

Security for python-pydebug 0.6

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page