Skip to main content

Yet another pretty printer for tables and trees

Project description

yappt

Yet another pretty printer for tables and trees.

Note: Versions 0.3.0 and later aren't compatible with earlier versions

A collection of classes and functions to format textual data for printing. The main functions (tabulate and treeiter) do not require reading entire dataset into memory, allowing printing large amount of data in streaming fashion.

Class Capabilities
PrettyInt When formatted, returns human-readable value. It can either show K,M,G suffix or exponential notation
Duration When formatted, returns a value that shows duration in hours, minutes and seconds.
Function Capabilities
tabulate Pretty prints an iterable of either dataclass objects or iterable of sequences of strings as a table
tabulate_iter Like tabulate but returns an iterable over formatted lines of text instead of printing it
treeiter Returns an iterable over tuples of formatted representation of tree node and the original node
strip_pfx strips a common prefix from all substrings that are separated by new-lines
indent indents all substrings that are separated by new-lines
iter_more accepts an iterable and returns a new iterable that returns original item and a more items indicator
format_bool format boolean values as unicode "✓" and "✗" code points

Refer to tests/ folder for examples and usage

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

yappt-0.3.2.tar.gz (12.7 kB view hashes)

Uploaded Source

Built Distribution

yappt-0.3.2-py3-none-any.whl (13.0 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page