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, 3.8 or 3.9. 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.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

Project details


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 details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

Details for the file devtools-0.8.0.tar.gz.

File metadata

  • Download URL: devtools-0.8.0.tar.gz
  • Upload date:
  • Size: 15.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.12

File hashes

Hashes for devtools-0.8.0.tar.gz
Algorithm Hash digest
SHA256 6162a2f61c70242479dff3163e7837e6a9bf32451661af1347bfa3115602af16
MD5 7f753bfeecfe83eedf743058ddc60de6
BLAKE2b-256 402a7e426b9af1111c1228e2aa543b43643e80204f0be0d45f7067d0d4e860be

See more details on using hashes here.

File details

Details for the file devtools-0.8.0-py3-none-any.whl.

File metadata

  • Download URL: devtools-0.8.0-py3-none-any.whl
  • Upload date:
  • Size: 14.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.12

File hashes

Hashes for devtools-0.8.0-py3-none-any.whl
Algorithm Hash digest
SHA256 00717ef184223cf36c65bbd17c6eb412f8a7564f47957f9e8b2b7610661b17fb
MD5 d97ea06f6b9c7fe474333b676f0bbf39
BLAKE2b-256 541132e995d0978b8898fbdb35179186b0155355db2fdd20f7058761b27006e2

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page