Skip to main content

TurboConsole

Lightweight Python library for terminal output with ANSI colors, boxes, and a progress bar. No external dependencies (standard library only). Compatible with Windows, macOS, and Linux.

Installation

From PyPI (when published):

pip install turboconsole

From source (development):

git clone https://github.com/FranciscoZanonDP/TurboConsole.git
cd TurboConsole
pip install -e .

Or add the project root to PYTHONPATH to use without installing.

Quick start: from turboconsole import Turbo; Turbo().info("Ready")

Usage

from turboconsole import Turbo

t = Turbo()
t.clear()
t.info("Library initialized on " + t.system)
t.success("All good")
t.warning("Watch out")
t.error("Something failed")

t.box("Content here.\nMultiple lines.", title="Title")

for item in t.progress_bar(range(100), prefix="Processing: "):
    pass  # your logic

Version

To get the package version:

from turboconsole import __version__
# or: import turboconsole; print(turboconsole.__version__)

Constructor

Turbo(force_color=False, no_emoji=False)

  • force_color: If True, use ANSI colors even when stdout is not a TTY (e.g. in redirected logs).
  • no_emoji: If True, log messages have no emoji (only [INFO], [OK], [WARN], [ERROR] labels).

API

Method Description
clear() / limpiar() Clear the screen (ANSI on all OS when VT and TTY; else cls / clear)
info(text) Blue message (text optional; None treated as empty)
success(text) Green message (text optional; None treated as empty)
warning(text) Yellow message (text optional; None treated as empty)
error(text) Red message (text optional; None treated as empty)
box(content, title="", max_width=None, *, texto=..., titulo=...) Unicode box around text; content and title optional (None as empty). Deprecated aliases: texto, titulo. max_width limits line width (default: terminal columns - 4 when TTY).
progress_bar(iterable, prefix="", width=40, total=None, prefijo=...) Generator with progress bar on the same line; prefix for label; total for percentage when iterable has no len(). For correct percentage, total should match the number of items. Deprecated alias: prefijo.
system Property: detected OS

Redirection and non-TTY

When stdout is not a TTY (e.g. python script.py > out.txt or in a pipe):

  • No ANSI codes are sent (plain output).
  • The progress bar does not update in place; only a new line is printed when done.

This avoids ANSI in files and overwritten lines when redirecting.

Known limits

  • progress_bar: width is clamped to 1–120.
  • box: When there is no terminal (e.g. no TTY), max_width defaults to None and long lines are not truncated; pass max_width explicitly if needed.

On Windows, ctypes is used to enable ANSI sequences in CMD/PowerShell, and console mode is restored on process exit.

Tests

python -m unittest discover -s tests -v

Lint

With dev dependencies installed (pip install -e ".[dev]"):

ruff check turboconsole/ tests/

Metadata

Release files for turboconsole 1.0.0

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

Source distribution (sdist)

Source distribution for turboconsole 1.0.0
File Size Uploaded
turboconsole-1.0.0.tar.gz 11.6 kB Details

Built distribution (wheel)

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

Total release size: 20.0 kB

Release files / turboconsole-1.0.0.tar.gz

Download URL turboconsole-1.0.0.tar.gz
Size 11.6 kB
Tags Source
SHA-256 checksum
How to use checksums
871bcac75dabe98a1677067dbedc7e7728099fabf6423b2a167156fda065ae02
BLAKE2b-256 checksum
How to use checksums
43428d413f97689070d2d7f89ef2e59aff0d4db0336fde70921b43bd693a7654
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.2

Release files / turboconsole-1.0.0-py3-none-any.whl

Download URL turboconsole-1.0.0-py3-none-any.whl
Size 8.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fdd9421dbea5ebb411d033b5795f007357fb29d2ac8612a1eb77664ddd6c6538
BLAKE2b-256 checksum
How to use checksums
7cf1c62bc159ce91c9f5f79c580cd97b2129d9a7c143401a41058f2c988a322b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.2

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

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