Skip to main content

Python's missing debug print command and other development tools.

Project description

python devtools

CI Coverage pypi versions license

Python's missing debug print command and other development tools.

For more information, see documentation.

Install

Just

pip install devtools[pygments]

pygments is not required but if it's installed, output will be highlighted and easier to read.

devtools has no other required dependencies except python 3.6, 3.7, or 3.8. If you've got python 3.6+ and pip installed, you're good to go.

Usage

from devtools import debug

whatever = [1, 2, 3]
debug(whatever)

Outputs:

test.py:4 <module>:
    whatever: [1, 2, 3] (list)

That's only the tip of the iceberg, for example:

import numpy as np

data = {
    'foo': np.array(range(20)),
    'bar': {'apple', 'banana', 'carrot', 'grapefruit'},
    'spam': [{'a': i, 'b': (i for i in range(3))} for i in range(3)],
    'sentence': 'this is just a boring sentence.\n' * 4
}

debug(data)

outputs:

python-devtools demo

Usage without Import

modify /usr/lib/python3.8/sitecustomize.py making debug available in any python 3.8 code

# add devtools debug to builtins
try:
    from devtools import debug
except ImportError:
    pass
else:
    __builtins__['debug'] = debug

v0.6.0 (2020-07-29)

  • improve __pretty__ to work better with pydantic classes, #52
  • improve the way statement ranges are calculated, #58
  • drastically improve import time, #50
  • pretty printing for non-standard dicts, #60
  • better statement finding for multi-line statements, #61
  • colors in windows, #57
  • fix debug(type(dict(...))), #62

v0.5.1 (2019-10-09)

  • fix python tag in setup.cfg, #46

v0.5.0 (2019-01-03)

  • support MultiDict, #34
  • support __pretty__ method, #36

v0.4.0 (2018-12-29)

  • remove use of warnings, include in output, #30
  • fix rendering errors #31
  • better str and bytes wrapping #32
  • add len everywhere possible, part of #16

v0.3.0 (2017-10-11)

  • allow async/await arguments
  • fix subscript
  • fix weird named tuples eg. mock > call_args
  • add timer

v0.2.0 (2017-09-14)

  • improve output
  • numerous bug fixes

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 devtools, version 0.6
Filename, size File type Python version Upload date Hashes
Filename, size devtools-0.6-py3-none-any.whl (14.9 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size devtools-0.6.tar.gz (15.7 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page