smartprinter

Cross-platform Python library, smart printer for console applications

Normal output, colored output, pager support, centered text with indentation.


smartprinter - cross-platform Python library for smart printing in console applications.

Has several different objects for displaying to the console or generating a string:

  • Normal output - standard echo
  • Colored output - ability to change the line color
  • Pager support - scroll up/down, exit, print after viewing
  • Centered output - print message in the center of the console with indentation

  • Normal Output - standard console printing
  • Colored Output - change line color (green, red, etc.)
  • Pager Support - scroll up/down, exit, print after viewing
  • Centered Output - message in the center of the console with indentation
  • Cross-Platform - Windows, Linux, macOS, Termux
  • Factory Pattern - PrintersFactory for easy creation

Via PyPI:

pip3 install smartprinter

With requirements:

pip install -r requirements.txt

For development:

pip install requirements/requirements-dev.txt

Using Printer class:

from smartprinter.printers import Printer

printer = Printer()
printer.base.echo('Text')
printer.click.echo('Text', show=True, color='green')
printer.smart.echo('Text', show=True, char='*')
printer.pager.echo('Text', show=True)

Using PrintersFactory:

from smartprinter.printers import PrintersFactory

def_printer = PrintersFactory.get_base()
click_printer = PrintersFactory.get_click()
smart_printer = PrintersFactory.get_smart()
pager = PrintersFactory.get_pager()

PrinterDescriptionParameters
baseNormal outputtext
clickColored outputtext, show=True, color='green'
smartCentered output with indentationtext, show=True, char='*'
pagerPager support (scrollable)text, show=True

Comprehensive test coverage with pytest:

pytest --cov --cov-report=html

By using this software, you agree to the full disclaimer terms.

Software provided "AS IS" without warranty. You assume all risks.

Full legal disclaimer: See DISCLAIMER.md

License: BSD 3-Clause License