Skip to main content

dprint

A printing debugging helper.

Motivation

dprint is inspired by a python-ideas thread, to show what's possible with a little bit of magic with plain Python code.

Installation

It's on PyPI as dprint. The obvious way will just work:

pip install dprint

Usage

Import the function dprint from the dprint module.

from dprint import dprint


def spam():
    eggs = 10
    dprint(eggs * 2)

spam()

Running the above script gives:

$ python script.py
script.py:6 in spam
  eggs * 2 -> 20

Operational Assumptions

The current logic for figuring out the expression passed to dprint operates under some assumptions:

  • The imported function must be called dprint
  • A call should span no more than 1 line
  • No more than 1 call on 1 line

A future version might relax these assumptions.

License

All files in this repository are under the MIT license.

Metadata

Release files for dprint 0.1.0

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

Source distribution (sdist)

Source distribution for dprint 0.1.0
File Size Uploaded
dprint-0.1.0.tar.gz 4.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for dprint 0.1.0
File Interpreter ABI Platform
dprint-0.1.0-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 11.8 kB

Release files / dprint-0.1.0.tar.gz

Download URL dprint-0.1.0.tar.gz
Size 4.4 kB
Tags Source
SHA-256 checksum
How to use checksums
103af899be7f27a0be60cd16ae6cd3a86548e29057067a79ad6e14091c0b0a1b
BLAKE2b-256 checksum
How to use checksums
2116008612c155e93b66e384ae2eba946f158afdecac232254a3b8062e61593d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / dprint-0.1.0-py2.py3-none-any.whl

Download URL dprint-0.1.0-py2.py3-none-any.whl
Size 7.4 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
bbb814f9fbf4d22e1bd17e7c7ce397ba23ac7fba62439faa4272a0975b0f24d1
BLAKE2b-256 checksum
How to use checksums
001ed83f6d2f0ec1bcc4140a6865e462ea232ba80854aafb4d7af97ac72adc04
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

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