Skip to main content

A Python library for pretty printing and enhanced console output.

Project description

PrettyPi

PyPI - Python Version PyPI version PyPI - License PyPI - Downloads Doc - link

PrettyPi is a Python library for enhancing console output with colorful and style text, emojis, tables, and more.

Features

  • PrettyPrint
    • Emoji: Add emojis to your console messages.
    • Color: Easily print text in various colors.
    • Style: Easily print text with style.
    • Background Color: Print text with colored background.
    • Alignment: Support text alignment (left, center, right).
    • Alert: print alert messages
  • PrettyTable
    • Display: Create and display tables in the console.
    • Custom: Customize table formatting and styles.
    • Template: Define and use templates for displaying tables.
    • Sorting: Implement sorting functionality for table columns.
    • Filtering: Add filtering capabilities to tables based on user-defined criteria.
    • Pagination: Enable pagination for large datasets displayed in tables.
  • PrettyTree
    • Display: Create and display tree.
    • Color: Color node in tree.
    • Style: Custom style node in tree.

Installation

You can install PretiPy using pip:

pip install prettypi

Usage

Here's a quick example of how to use PrettyPi:

pretty_print

from prettypi.pretty_print import StyledStr
from prettypi.pretty_print.utils import Color, Style, Emoji, BackgroundColor

styled_str = StyledStr("My name", background_color=BackgroundColor.MAGENTA, style=Style.UNDERLINE)
styled_str2 = StyledStr("Toto", color=Color.RED, style=Style.BOLD)

print(f"{styled_str} is {styled_str2} {Emoji.SMILE}")

pretty_print Alert

from prettypi.pretty_print import Alert

alert = Alert.info("This is an information alert")
print(alert)

pretty_tree

from prettypi.pretty_tree import TreeNode
from prettypi.pretty_print.utils import Color, Style

root = TreeNode("Root", color=Color.RED, style=Style.BOLD)
child1 = TreeNode("Child1")
child2 = TreeNode("Child2")

child1.add_child(TreeNode("Child1.1"))
child1.add_child(TreeNode("Child1.2"))

root.add_child(child1)
root.add_child(child2)

root.display()

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

prettypi-0.3.0.tar.gz (8.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

prettypi-0.3.0-py3-none-any.whl (10.2 kB view details)

Uploaded Python 3

File details

Details for the file prettypi-0.3.0.tar.gz.

File metadata

  • Download URL: prettypi-0.3.0.tar.gz
  • Upload date:
  • Size: 8.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for prettypi-0.3.0.tar.gz
Algorithm Hash digest
SHA256 f153e63f77c92d5da17f22126f913e620bf9be432afb5dda53331a08c617e28e
MD5 cd2eb5a7e4dc03c3a31544801659ece1
BLAKE2b-256 e3c237af10cc0e45237e1d09c8cb0b24a1f05423a8c1b5be7e4aed99f243736b

See more details on using hashes here.

File details

Details for the file prettypi-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: prettypi-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 10.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for prettypi-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3f98fedb4d63f288707ce6365cd6d966bded8f55023f80fa4c46b96bb5c97b2b
MD5 ad81ba9a22d613a0007ece47931889c0
BLAKE2b-256 0a06d7f2fb24dbe4e217453f3842fa5ab495051d91a185b15d4dc68a5f35dab5

See more details on using hashes here.

Supported by

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