All Projects → tommikaikkonen → Prettyprinter

tommikaikkonen / Prettyprinter

Licence: mit
Syntax-highlighting, declarative and composable pretty printer for Python 3.5+

Programming Languages

python
139335 projects - #7 most used programming language

Labels

Projects that are alternatives of or similar to Prettyprinter

consono
The most correct, informative, appealing and configurable variable inspector for JavaScript
Stars: ✭ 17 (-94.41%)
Mutual labels:  print
pydbg
Python implementation of the Rust `dbg` macro
Stars: ✭ 85 (-72.04%)
Mutual labels:  print
objprint
A library that can print Python objects in human readable format
Stars: ✭ 141 (-53.62%)
Mutual labels:  print
THREE.Highres
High resolution and depth rendering to PNG for Three.js
Stars: ✭ 28 (-90.79%)
Mutual labels:  print
ipp.rs
IPP protocol implementation for Rust
Stars: ✭ 24 (-92.11%)
Mutual labels:  print
senaite.impress
HTML to PDF Rendering Engine for SENAITE
Stars: ✭ 16 (-94.74%)
Mutual labels:  print
table
Produces a string that represents slice data in a text table, inspired by gajus/table.
Stars: ✭ 130 (-57.24%)
Mutual labels:  print
Cordova Plugin Printer
Print HTML documents
Stars: ✭ 265 (-12.83%)
Mutual labels:  print
mkdocs-print-site-plugin
MkDocs Plugin that adds an additional page that combines all pages, allowing easy exports to PDF and standalone HTML.
Stars: ✭ 38 (-87.5%)
Mutual labels:  print
gscloudplugin
浏览器打印PDF。 浏览器打印HTML。 浏览器打印图片。 浏览器打印Word。浏览器打印Excel。浏览器打印PPT。浏览器打印自定义绘图。浏览器打印微软报表。 使用静默方式打印。蓝牙打印。读写串口数据。读取电子秤重量
Stars: ✭ 18 (-94.08%)
Mutual labels:  print
ngx-print
🖨️ A plug n' play Angular (2++) library to print your stuff
Stars: ✭ 124 (-59.21%)
Mutual labels:  print
print
Android print app
Stars: ✭ 18 (-94.08%)
Mutual labels:  print
react-native-star-prnt
React-Native bridge to communicate with Star Micronics Bluetooth/LAN Printers
Stars: ✭ 61 (-79.93%)
Mutual labels:  print
vue-iframe-print
一款支持局部打印的 vue插件
Stars: ✭ 26 (-91.45%)
Mutual labels:  print
bonaparticle
The LaTeX magazine class that doesn’t get in your way.
Stars: ✭ 20 (-93.42%)
Mutual labels:  print
paper-terminal
Print Markdown to a paper in your terminal
Stars: ✭ 33 (-89.14%)
Mutual labels:  print
nativescript-printer
📠 Send an image or the screen contents to a physical printer
Stars: ✭ 33 (-89.14%)
Mutual labels:  print
Redux Offline Docs
Redux documentation in PDF, ePub and MOBI formats for offline reading.
Stars: ✭ 292 (-3.95%)
Mutual labels:  print
JimuReport
「低代码可视化报表」类似excel操作风格,在线拖拽完成设计!功能涵盖: 报表设计、图形报表、打印设计、大屏设计等,完全免费!秉承“简单、易用、专业”的产品理念,极大的降低报表开发难度、缩短开发周期、解决各类报表难题。
Stars: ✭ 2,895 (+852.3%)
Mutual labels:  print
printer
A fancy logger yet lightweight, and configurable. 🖨
Stars: ✭ 65 (-78.62%)
Mutual labels:  print

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

Documentation_

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

.. code:: bash

pip install prettyprinter
  • 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:

.. image:: prettyprinterlightscreenshot.png :alt:

.. image:: ../prettyprinterlightscreenshot.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, which you can enable by calling prettyprinter.install_extras():

  • datetime - (installed by default)
  • enum - (installed by default)
  • pytz - (installed by default)
  • dataclasses - any new class you create will be pretty printed automatically
  • attrs - pretty prints any new class you create with attrs
  • django - pretty prints your Models and QuerySets
  • numpy - pretty prints numpy scalars with explicit types
  • requests - pretty prints Requests, Responses, Sessions, and more from the requests library
  • Free software: MIT license
  • Documentation: Documentation_.

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

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].