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.

Source Distribution

devtools-0.6.1.tar.gz (15.8 kB view details)

Uploaded Source

Built Distribution

devtools-0.6.1-py3-none-any.whl (15.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: devtools-0.6.1.tar.gz
  • Upload date:
  • Size: 15.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.0 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.6

File hashes

Hashes for devtools-0.6.1.tar.gz
Algorithm Hash digest
SHA256 a054307594d35d28fae8df7629967363e851ae0ac7b2152640a8a401c39d42d7
MD5 f5cf5b4f0102cb00ddadab213a2d4817
BLAKE2b-256 0502a72f52c5604c3fc3eab1e2ef6d9917ec601d41e86079e093b78a21b2f953

See more details on using hashes here.

File details

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

File metadata

  • Download URL: devtools-0.6.1-py3-none-any.whl
  • Upload date:
  • Size: 15.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.0 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.6

File hashes

Hashes for devtools-0.6.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7334183972a8d04e81d08b7f62126abca9b6f4de51d825c5fdcb9c88f252601a
MD5 ead7a869f4273ebec56203167feab0d0
BLAKE2b-256 eb5dfe034959b814b78d389fd4135011bee6b1fe1f05b4540001f34b7a6e6cf9

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