A simple terminal I/O utility with spinner animation
Project description
Consolio
Consolio is a lightweight, dependency-free Python library that provides an elegant way to display progress updates, warnings, errors, and other status messages in the console with color-coded indicators, spinners, and progress bars.
Perfect for CLI tools that need clean, structured feedback without complex dependencies.
Installation
Consolio has no external dependencies and works out of the box.
pip install consolio
If you’re using it directly from source (e.g., cloned repository), add the src/ folder to your PYTHONPATH or sys.path:
import sys, os
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), 'src')))
from consolio import Consolio
Features
- ✅ Color-coded messages for info, warning, error, success, and more.
- 🔁 Built-in progress spinners (
dots,braille,default). - 📈 Context-managed progress bars.
- 🧩 Thread-safe and clean terminal rendering (no output corruption).
- ⚙️ Works gracefully in both TTY and non-TTY (plain/CI) modes.
- 🔄 Indentation helpers (
increase_indent,decrease_indent, etc.) for hierarchical output.
Basic Usage
from consolio import Consolio
console = Consolio(spinner_type='dots')
console.print("inf", "Starting process")
console.print("wip", "Loading configuration...")
console.print("wrn", "Warning: Low memory detected")
console.print("err", "Error: Invalid input detected")
console.print("cmp", "All done!")
Indentation Control
You can now manage indentation dynamically without passing it every time.
console.increase_indent()
console.print("wip", "Setting up environment...")
console.increase_indent()
console.print("inf", "Fetching dependencies...")
console.decrease_indent()
console.print("cmp", "Setup complete.")
Explicit indentation still works:
console.print(2, "inf", "Manual indentation works too.")
Spinners
Use the spinner as a context manager:
import time
with console.spinner("Working hard...", inline=True):
time.sleep(2)
console.print("cmp", "Task complete!")
Or manually start and stop it:
console.start_animate()
time.sleep(3)
console.stop_animate()
Progress Bars
import time
with console.progress(initial_percentage=0) as update:
for i in range(0, 101, 20):
time.sleep(0.3)
update(i)
console.print("cmp", "Progress complete!")
Input Handling
user = console.input("qst", "Enter your name:")
console.print("cmp", f"Hello, {user}!")
Customization
| Option | Description | Example |
|---|---|---|
spinner_type |
Type of spinner (dots, braille, default) |
Consolio(spinner_type='braille') |
no_colors |
Disable ANSI colors | Consolio(no_colors=True) |
no_animation |
Disable spinners/progress bars | Consolio(no_animation=True) |
replace=True |
Overwrite previous message line | console.print("inf", "Updating...", replace=True) |
plain() |
Force plain output (no color/animation) | console.plain() |
rich() |
Re-enable color/animation if supported | console.rich() |
Example Structure
Example scripts are located in the examples/ folder:
example_basic_usage.py— Interactive demo with spinner and progress bar.example_plain_mode.py— CI-friendly non-interactive demo.
Run them directly:
python examples/example_basic_usage.py
License
This project is licensed under the MIT License — see the LICENSE file for details.
Made with ❤️ by devcoons
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file consolio-0.1.15.tar.gz.
File metadata
- Download URL: consolio-0.1.15.tar.gz
- Upload date:
- Size: 10.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.23
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
17d723468e4f8545d06fd8e1ae21c752549fb0e99c27c20429fd692b8b28c7aa
|
|
| MD5 |
e762198ec4022adf95c221f41b60e6f1
|
|
| BLAKE2b-256 |
20382605162816a9172fe7f46dba9fd17916978913834406f1844b3e9c5ea8ba
|
File details
Details for the file consolio-0.1.15-py3-none-any.whl.
File metadata
- Download URL: consolio-0.1.15-py3-none-any.whl
- Upload date:
- Size: 9.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.23
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
70910195cf61dec564e08564dc02c61b733e86b82f3f37aa9783d95e88c0a158
|
|
| MD5 |
d6d92547862819e9d655115e8051741b
|
|
| BLAKE2b-256 |
4ea8e089e0d5a112a9a3f9b8da77eeda269ad939ea75962df0d6ac4efbe22144
|