Metadata-Version: 2.0
Name: show
Version: 1.4.7
Summary: Debug print statements, done right. E.g. show(x)
Home-page: https://bitbucket.org/jeunice/show
Author: Jonathan Eunice
Author-email: jonathan.eunice@gmail.com
License: Apache License 2.0
Keywords: debug print display show
Platform: UNKNOWN
Classifier: Development Status :: 4 - Beta
Classifier: Operating System :: OS Independent
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.6
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Printing
Classifier: Topic :: Software Development :: Debuggers
Requires-Dist: mementos (>=1.2.5)
Requires-Dist: options (>=1.4.4)
Requires-Dist: pygments (>=2.2.0)
Requires-Dist: readline
Requires-Dist: say (>=1.4.3)
Requires-Dist: six (>=1.10)

| |version| |versions| |impls| |wheel| |coverage|

.. |version| image:: http://img.shields.io/pypi/v/show.svg?style=flat
    :alt: PyPI Package latest release
    :target: https://pypi.python.org/pypi/show

.. |versions| image:: https://img.shields.io/pypi/pyversions/show.svg
    :alt: Supported versions
    :target: https://pypi.python.org/pypi/show

.. |impls| image:: https://img.shields.io/pypi/implementation/show.svg
    :alt: Supported implementations
    :target: https://pypi.python.org/pypi/show

.. |wheel| image:: https://img.shields.io/pypi/wheel/show.svg
    :alt: Wheel packaging support
    :target: https://pypi.python.org/pypi/show

.. |coverage| image:: https://img.shields.io/badge/test_coverage-80%25-00BFFF.svg
    :alt: Test line coverage
    :target: https://pypi.python.org/pypi/show

::

    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,

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

Decorate a function with ``@show.inout`` and it will show you the
input parameters as the function is called, and 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 run `show.prettyprint()` after importing, show will use
the `Pygments <http://pygments.org/>`_ syntax highlighter to
print data values, if it's installed. This can significantly help
if you're pringing complex lists and dictionaries.

Finally, ``show`` does normal output too, just like
`say <https://pypi.python.org/pypi/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
<http://show.readthedocs.org/en/latest/>`_.

New and Notable
===============

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.


.. warning::
    There are some outstanding issues with Windows.
    Also, when evaluating ``show``, do so
    from a program file or from IPython, not from the plain
    interactive REPL. It's much more robust and effective
    in either standard, non-interactive execution or in IPython
    interactive use than it is in the plain Python REPL, which
    simply doesn't provide quality introspection.


