Skip to main content
PyPI Package latest release Supported versions Supported implementations Wheel packaging support Test line coverage
from show import *

x = 12
nums = list(range(4))

show(x, nums)

yields:

x: 12  nums: [0, 1, 2, 3]

Output is self-labeled, so you don’t spend time doing that yourself.

Debug Printing

Logging, assertions, unit tests, and interactive debuggers are all great tools. But sometimes you just need to print values as a program runs to see what’s going on. Every language has features to print text, but they’re rarely customized for printing debugging information. show is. It provides a simple, DRY mechanism to “show what’s going on.”

Sometimes programs print so that users can see things, and sometimes they print so that developers can. show() is for developers, helping rapidly print the current state of variables in ways that easily identify what value is being printed, without a lot of wasted effort. It replaces the craptastic repetitiveness of:

print "x: {0!r}".format(x)

with:

show(x)

And if you have a lot of output flowing by, and it’s hard to see your debugging output, try:

show(x, y, z, style='red')

And now you have debug output that clearly stands out from the rest.

But “debug printing is so very 1989!” you may say. “We now have logging, logging, embedded assertions, unit tests, …” Yes, that’s true. But wonderful as those things are, just showing your current program values is often what the doctor ordered.

And Much More

While avoiding a few extra characters of typing and a little extra program complexity is nice (very nice, actually), show does much more. As just a taste, show.changed() displays local values that have changed since it was last run:

def f():
    x = 4
    show.changed()
    x += 1
    retval = x * 3
    show.changed()
    return retval

When run will display:

x: 4
x: 5  retval: 15

Functions decorated with @show.inout show you input parameters as the function is called, then the return value later.:

@show.inout
def g(a):
    b = 3
    a += b
    show.changed()
    return a

g(4)

Displays:

g(a=4)
a: 7  b: 3
g(a=4) -> 7

(If you want this terser, decorate with @show.inout(only='out').)

If you run show.prettyprint() after importing, or alternatively if you import with from show.pretty import *, the Pygments syntax highlighter will (if installed), be used to colorize data values. This can significantly help see complex lists and dictionaries.

Finally, show does normal output too, just like say (with all of its high-level text formatting):

wizard = "Gandalf"
show("You have no power here, {wizard}!")

Prints:

You have no power here, Gandalf!

Long story short, show is a strong debugging companion that prints the maximum amount of useful information with the minimum amount of fuss.

For more, see the full documentation at Read the Docs.

New and Notable

Try from show.pretty import *.

IPython is now well-supported, either in a terminal window or a Jupyter Notebook. In other words, show now supports interactive usage. (The plain Python REPL is still only marginally supported, given significant weaknesses in its introspection support.)

A relatively new capability is to differentially set the formatting parameters on a method by method basis. For example, if you want to see separators in green and function call/return annotations in red:

show.sep.set(style='green')
show.inout.set(style='red')

You could long do this on a call-by-call basis, but being able to set the defaults just for specific methods allows you to get more formatting in with fewer characters typed. This capability is available on a limited basis: primarily for format-specific calls (blanklines, hr, sep, and title) and for one core inspection call (the inout decorator). It will be extended, and mapped back to underlying say and options features over time.

Metadata

Release files for show 1.6.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 show 1.6.0
File Size Uploaded
show-1.6.0.zip 74.7 kB Details

Built distribution (wheel)

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

Total release size: 118.9 kB

Release files / show-1.6.0.zip

Download URL show-1.6.0.zip
Size 74.7 kB
Tags Source
SHA-256 checksum
How to use checksums
5317c2f0e43a15af580e2698d16f5b7dccddc597a945267b3a1f0164c6e8d340
BLAKE2b-256 checksum
How to use checksums
2db3b2edb821a57a0dbefd65fb5e5971d7b876c0b835b5c72516262e91a65ec2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / show-1.6.0-py2.py3-none-any.whl

Download URL show-1.6.0-py2.py3-none-any.whl
Size 44.2 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
a9ae9b2e1fff4d2c83b362a89db208e154592453eda1ae990c849ac6d2c53d17
BLAKE2b-256 checksum
How to use checksums
1c0761b02282c1e5fff9020036aa97bad51c3bf9ef5547330d9b2401d75f4955
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

1.6.0 This release

2 release files

1.5.0

2 release files

1.4.8

2 release files

1.4.7

2 release files

1.4.6

2 release files

1.4.5

2 release files

1.4.4

2 release files

1.4.3

2 release files

1.4.2

2 release files

1.4.1

2 release files

1.4.0

2 release files

1.3.2

2 release files

1.3.1

2 release files

1.3.0

2 release files

1.2.7

2 release files

1.2.6

3 release files

1.2.5

3 release files

1.2.4

3 release files

1.2.3

3 release files

1.2.2

3 release files

1.2.1

3 release files

1.2.0

3 release files

1.1.1

3 release files

1.1.0

3 release files

1.0.2

2 release files

1.0.1

2 release files

1.0

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