Skip to main content

A simple terminal I/O utility with spinner animation

Project description

Consolio

PyPI - Version PyPI - Python Version GitHub License PyPI - Wheel

Consolio is a Python library that provides an elegant way to display progress updates, warnings, errors, and other status messages in the console with color-coded indicators and spinners. Ideal for CLI applications that require step-by-step feedback to users.

Table of Contents

Installation

Consolio does not require any dependencies outside of Python's standard library. To use it just install it using pip install consolio.

Features

  • Color-coded messages for different statuses: Success, Error, Warning, and more.
  • Progress spinners in various styles (dots, braille, default).
  • Inline spinners for seamless progress tracking within a single line.
  • Thread-safe output for smooth and consistent console display.

Usage

Basic Initialization

To get started, initialize Consolio with a desired spinner type. You can choose from dots, braille, or default.

from consolio import Consolio

console = Consolio(spinner_type='dots')  # Initialize with dots spinner

Status Message Types

Consolio supports multiple status messages, each with a unique color and symbol:

  • Start: [+] Blue - Marks the start of a process
  • Step: [-] Cyan - Intermediate step in a process
  • Warning: [!] Yellow - Displays warnings
  • Error: [x] Red - Displays errors
  • Complete: [v] Green - Indicates completion of a step or process

Use the sprint method to print messages with a specific status, indentation level, and replacement option:

console.sprint(indent=0, status="str", text="Starting process")
console.sprint(indent=1, status="stp", text="Executing step 1")
console.sprint(indent=1, status="wrn", text="Warning: Check your input")
console.sprint(indent=1, status="err", text="Error: Process failed")
console.sprint(indent=0, status="cmp", text="Process complete")

Spinners

You can start a spinner to indicate an ongoing process using the start_animate method, then stop it using stop_animate.

console.start_animate(indent=1)
# Perform a time-consuming task here
time.sleep(3)  # Simulating task duration
console.stop_animate()

Use the inline_spinner=True option to display the spinner on the same line as the last message:

console.sprint(1, "stp", "Calculating size")
console.start_animate(inline_spinner=True)
time.sleep(2)
console.stop_animate()

Customization

The Consolio library supports a few customization options:

  • Spinner Type: Set spinner_type to dots, braille, or default.
  • Indentation Level: Control indentation level in messages for organized output.
  • Inline Spinner: Use inline_spinner=True to keep spinners on the same line as a message.
  • Replacement Mode: Set replace=True in sprint to overwrite the previous message line.

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

consolio-0.0.8.tar.gz (7.7 kB view details)

Uploaded Source

Built Distribution

consolio-0.0.8-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

Details for the file consolio-0.0.8.tar.gz.

File metadata

  • Download URL: consolio-0.0.8.tar.gz
  • Upload date:
  • Size: 7.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.20

File hashes

Hashes for consolio-0.0.8.tar.gz
Algorithm Hash digest
SHA256 e59e13ea771bc5fad0673e8c576b1ba2c5100e90eb933526dbd2f4d41df4e82e
MD5 ad2b83db6f8114ddbaa61c650bae32b7
BLAKE2b-256 4ccd7d48b03c6ff2acd814fec469e9acfac84fe72d9054223355909af514265b

See more details on using hashes here.

File details

Details for the file consolio-0.0.8-py3-none-any.whl.

File metadata

  • Download URL: consolio-0.0.8-py3-none-any.whl
  • Upload date:
  • Size: 7.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.20

File hashes

Hashes for consolio-0.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 d4d03a8319f1d24bcf265595818b4a1ff57c97ae93e539aae6f6ca6de1b2ff25
MD5 19915a8eedf11b9129a90db6fced1603
BLAKE2b-256 9eb25f4e8c9fea573a69f2202880f4f1a7e47186371d7ff32106692e5918eff1

See more details on using hashes here.

Supported by

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