Bun

Bun (Basic user interface) is a small Python package for a basic user interface.

This package grew out of a desire to satisfy two goals simultaneously: (1) have the simplest possible coding interface for printing color-coded messages and getting basic information from the user; and (2) let the user choose to use a command-line interface (CLI) or a graphical user interface (GUI) at run time. Bun (Basic user interface) is the result. It provides functions such as inform, warn, alert and others, which you can use in code like this:

if writable(dest_dir):
    inform(f'Will write output to {dest_dir}.')
else:
    alert(f'Output destination {dest_dir} is not writable.')

Bun is simple and limited in functionality, as well as being somewhat opinionated in its design, but it satisfies the needs of many programs. Bun wraps packages such as Rich and wxPython to provide simple high-level calls. Here is some sample output from an application that uses Bun:

cli-output-example
Many user interface packages already exist for Python, but their use requires configuration and more complicated code to use. Bun aims to be simpler.

Installation

The instructions below assume you have a Python interpreter installed on your computer; if that's not the case, please first install Python version 3 and familiarize yourself with running Python programs on your system.

On Linux, macOS, and Windows operating systems, you should be able to install bun with pip. To install bun from the Python package repository (PyPI), run the following command:

python3 -m pip install bun --upgrade

As an alternative to getting it from PyPI, you can use pip to install bun directly from GitHub, like this:

python3 -m pip install git+https://github.com/caltechlibrary/bun.git --upgrade

GitHub

https://github.com/caltechlibrary/bun