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.



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, 3.8 or 3.9. If you've got python 3.6+ and pip installed, you're good to go.


from devtools import debug

whatever = [1, 2, 3]

Outputs: <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



python-devtools demo

Usage without Import

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

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

v0.7.0 (2021-09-03)

  • switch to executing and asttokens for finding and printing debug arguments, #82, thanks @alexmojaki
  • correct changelog links, #76, thanks @Cielquan
  • return debug() arguments, #87
  • display more generators like map and filter, #88
  • display Counter and similar dict-like objects properly, #88
  • display dataclasses properly, #88
  • uprev test dependencies, #81, #83, #90

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

Download files

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

Source Distribution

devtools-0.8.0.tar.gz (15.0 kB view hashes)

Uploaded source

Built Distribution

devtools-0.8.0-py3-none-any.whl (14.1 kB view hashes)

Uploaded py3

Supported by

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