Skip to main content
Archived

This project has been archived by its maintainers, and is no longer receiving any updates.

Bun

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

License Latest release Python DOI PyPI

Table of contents

Introduction

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:

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

Usage

[... forthcoming ...]

Known issues and limitations

As of version 0.0.5, the code for the GUI version is currently not included in the released version of Bun. The original code is in fact used by some applications, but the generalization and incorporation of that code into Bun is incomplete, so until more work is done, the GUI code is kept in a separate git branch (gui).

Getting help

If you find an issue, please submit it in the GitHub issue tracker for this repository.

Contributing

We would be happy to receive your help and participation with enhancing Bun! Please visit the guidelines for contributing for some tips on getting started.

License

Software produced by the Caltech Library is Copyright (C) 2020, Caltech. This software is freely distributed under a BSD/MIT type license. Please see the LICENSE file for more information.

Authors and history

I developed the first version of this code while implementing Holdit. I started using the code in essentially every Python software package I have written since then, first by copy-pasting the code (which was initially very short) and eventually creating a single-file module (named ui.py). This was obviously a suboptimal approach. Finally, in 2020, I decided it was time to break it out into a proper self-contained Python package.

Acknowledgments

This work was funded by the California Institute of Technology Library.

The vector artwork of a bun, used as the icon for this repository, was created by Vectors Market from the Noun Project. It is licensed under the Creative Commons CC-BY 3.0 license.

Metadata

Release files for bun 0.0.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bun 0.0.8
File Size Uploaded
bun-0.0.8.tar.gz 12.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for bun 0.0.8
File Interpreter ABI Platform
bun-0.0.8-py3-none-any.whl Python 3 none any Details

Total release size: 24.7 kB

Release files / bun-0.0.8.tar.gz

Download URL bun-0.0.8.tar.gz
Size 12.9 kB
Tags Source
SHA-256 checksum
How to use checksums
4953625b76c4b7990f51f11c7cd8275ac8f9b8932af7fe23a13c025a2969ed95
BLAKE2b-256 checksum
How to use checksums
8433f8b671a85df1b846bf7d8a0a9cb82d69f1f09daaaa2202831778d6bbc085
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.25.1 setuptools/57.0.0 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.9.5

Release files / bun-0.0.8-py3-none-any.whl

Download URL bun-0.0.8-py3-none-any.whl
Size 11.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c12d6305ae79f1ef95a3075238ae73ab11adfbc8b6e977a06a6793697e0ffd7b
BLAKE2b-256 checksum
How to use checksums
b0be9b62f8821bd48f8c1341e95dd73275fee7768beb739bcd67b10a39c62032
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.25.1 setuptools/57.0.0 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.9.5
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page