Skip to main content
Help us improve Python packaging – donate today!

Helpers for command line interaces (CLI) in terminal

Project Description

https://travis-ci.org/chrismaille/buzio.svg?branch=master https://coveralls.io/repos/github/chrismaille/buzio/badge.svg?branch=master Documentation Status

Buzio is a python library tool for printing formatted text in terminal, similar to termcolor or colored.

Installing Buzio

Install Buzio using the command:

$ pip install buzio

Importing the Library

from buzio import console, formatStr

The console is a instance of the Console class initialized with default color themes. You can also import the class and instantiate with your own settings (See the :doc:reference for more info)

The formatStr is also a instance of the Console class too, but instead of printing in terminal the message, this instance just return the formatted text.

The default color themes

Method Text Color
console.box Fore.CYAN
console.error Fore.RED
console.info Fore.CYAN
console.section Fore.LIGHTYELLOW_EX
console.success Fore.GREEN
console.warning Fore.YELLOW

These colors are based in colorama constants.

Generate fancy formats

“Section” example 1:

from buzio import console

console.section("First Section")

Terminal output:

$ >> First Section
$ ----------------

Humanize Python objects

Buzio can automatically humanize any python object for printing in terminal:

from datetime import datetime, timedelta
from buzio import console

today = datetime.now()
yesterday = today - timedelta(days=1)
my_dict = {
        "start day": yesterday,
        "end day": today
}

console.box(my_dict, date_format="%a, %b-%d-%Y")

The output on terminal will be (in blue color):

$ *********************************
$ *                               *
$ *  start day: Thu, Feb-01-2018  *
$ *   end day: Fri, Feb-02-2018   *
$ *                               *
$ *********************************

Ask for Input data

You can use Buzio to automatically generate “choose” and “select” questions, based on Python objects:

“Choose” example:

from buzio import console

my_choices = [
        "Orange",
        "Apple",
        "Potato"
]

console.choose(my_choices)

Terminal output:

$ 1. Orange
$ 2. Apple
$ 3. Potato
$
$ Select (1-3): ?

Run terminal commands

You can use Buzio to run terminal commands (using Python subprocess) and get the stdout result:

>>> from buzio import console
>>> ret = console.run("echo HelloWorld!", get_stdout=True, verbose=True)
Cmd: echo HelloWorld!
>>> print(ret)
HelloWorld!

Further reading

Please check full documentation in http://buzio.readthedocs.io/

Release history Release notifications

This version
History Node

1.1.2

History Node

1.1.1

History Node

1.1.0

History Node

1.0.1

History Node

1.0

History Node

1.0.dev59935

History Node

1.0.dev16732

History Node

1.0.dev15137

History Node

1.0.dev12810

History Node

1.0.dev12805

History Node

1.0.dev12801

History Node

1.0.dev12517

History Node

1.0.dev12516

History Node

1.0.dev12513

History Node

1.0.dev12496

History Node

1.0.dev12380

History Node

1.0.dev12305

History Node

1.0.dev12291

History Node

1.0.dev12290

History Node

1.0.dev12289

History Node

1.0.dev12264

History Node

1.0.dev12261

History Node

1.0.dev12258

History Node

1.0.dev12241

History Node

1.0.dev12233

History Node

1.0.dev12230

History Node

1.0.dev11199

History Node

1.0.dev11128

History Node

1.0.dev10847

History Node

1.0.dev10841

History Node

1.0.dev10769

History Node

1.0.dev9817

History Node

1.0.dev9811

History Node

1.0.dev9788

History Node

1.0.dev5117

History Node

1.0.dev5056

History Node

1.0.dev5055

History Node

1.0.dev5054

History Node

1.0.dev5047

History Node

1.0.dev5042

Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
buzio-1.1.2-py2.py3-none-any.whl (11.9 kB) Copy SHA256 hash SHA256 Wheel py2.py3 Apr 11, 2018
buzio-1.1.2.tar.gz (10.9 kB) Copy SHA256 hash SHA256 Source None Apr 11, 2018

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page