Metadata-Version: 2.0
Name: prettyprinter
Version: 0.2.0
Summary: Syntax-highlighting, declarative and composable pretty printer for Python 3.6+
Home-page: https://github.com/tommikaikkonen/prettyprinter
Author: Tommi Kaikkonen
Author-email: kaikkonentommi@gmail.com
License: MIT license
Keywords: prettyprinter
Platform: UNKNOWN
Classifier: Development Status :: 2 - Pre-Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Natural Language :: English
Classifier: Programming Language :: Python :: 3.6
Requires-Dist: Pygments (>=2.2.0)
Requires-Dist: colorful (>=0.4.0)

=============
PrettyPrinter
=============

Documentation_

Syntax-highlighting, declarative and composable pretty printer for Python 3.6+

- Drop in replacement for the standard library ``pprint``: just rename ``pprint`` to ``prettyprinter`` in your imports.
- Uses a modified Wadler-Leijen layout algorithm for optimal formatting
- Write pretty printers for your own types with a dead simple, declarative interface

.. image:: prettyprinterscreenshot.png
    :alt: 

.. image:: ../prettyprinterscreenshot.png
    :alt: 

Pretty print common Python values:

.. code:: python

    >>> from datetime import datetime
    >>> from prettyprinter import pprint
    >>> pprint({'beautiful output': datetime.now()})
    {
        'beautiful output': datetime.datetime(
            year=2017,
            month=12,
            day=12,
            hour=0,
            minute=43,
            second=4,
            microsecond=752094
        )
    }

As well as your own, without any manual string formatting:

.. code:: python

    >>> class MyClass:
    ...     def __init__(self, one, two):
    ...         self.one = one
    ...         self.two = two

    >>> from prettyprinter import register_pretty, pretty_call

    >>> @register_pretty(MyClass)
    ... def pretty_myclass(value, ctx):
    ...     return pretty_call(ctx, MyClass, one=value.one, two=value.two)

    >>> pprint(MyClass((1, 2, 3), {'a': 1, 'b': 2}))
    MyClass(one=(1, 2, 3), two={'a': 1, 'b': 2})

    >>> pprint({'beautiful output': datetime.now(), 'beautiful MyClass instance': MyClass((1, 2, 3), {'a': 1, 'b': 2})})
    {
        'beautiful MyClass instance': MyClass(
            one=(1, 2, 3),
            two={'a': 1, 'b': 2}
        ),
        'beautiful output': datetime.datetime(
            year=2017,
            month=12,
            day=12,
            hour=0,
            minute=44,
            second=18,
            microsecond=384219
        )
    }

Comes packaged with the following pretty printer definitions:

- ``datetime`` - (installed by default)
- ``enum`` - (installed by default)
- ``pytz`` - (installed by default)
- ``attrs`` - any new class you create will be pretty printed automatically
- ``django`` - your Models and QuerySets will be pretty printed automatically

* Free software: MIT license
* Documentation: Documentation_.

.. _Documentation: https://prettyprinter.readthedocs.io

=======
History
=======

0.2.0 (2017-12-12)
------------------

* Numerous API changes and improvements.


0.1.0 (2017-12-07)
------------------

* First release on PyPI.


