Skip to main content

Pretty terminal utilities wrapped around rich: colorful progress bars, dict-to-table printing, and more.

Project description

prettyterm

Pretty terminal utilities wrapped around Rich: colorful progress bars, dict-to-table printing, colored logging, and more.

Installation

pip install prettyterm

Features

track() - tqdm-like Progress Bar

A clean, colorful progress bar wrapper around Rich's progress module. Drop-in replacement for tqdm with enhanced formatting.

Features:

  • Progress bar with completion percentage
  • Elapsed and remaining time
  • Iteration speed (it/s)
  • Dynamic postfix updates (string or dict)
  • Auto-detects sequence length
from prettyterm import track

# Basic usage
for i in track(range(100), desc="Processing"):
    # Your code here
    pass

# With dynamic postfix
pbar = track(range(100), desc="Epoch 3")
for i in pbar:
    pbar.set_postfix({"loss": f"{0.5}", "acc": f"{95}%"})

Output:

Progress bar example

print_table() - Pretty Dictionary Tables

Display dictionaries as colorful, formatted tables. Great for configuration display, stats output, or debugging.

Features:

  • Automatic column sizing
  • Color-coded columns (cyan keys, orange values)
  • Optional table title
  • Optional row dividers
from prettyterm import print_table

data = {
    "Name": "Alice",
    "Age": 30,
    "City": "Wonderland",
    "Role": "Developer"
}

print_table(data, title="User Info", show_lines=True)

Output:

Table printing example

get_logger() - Colored Logging with SUCCESS Level

Get a pre-configured logger with colored output and a custom SUCCESS logging level (sits between INFO and WARNING).

Features:

  • Color-coded log levels
  • Custom SUCCESS level (green)
  • Auto-configured on import
  • Clean, piped format: timestamp │ level │ name │ message
from prettyterm import get_logger

logger = get_logger("my_app")

logger.debug("Detailed debug info")
logger.info("Application started")
logger.success("Operation completed!")  # Custom level
logger.warning("Resource usage high")
logger.error("Connection failed")
logger.critical("System shutting down")

Output:

Logger example

Log Colors:

  • DEBUG - Cyan
  • INFO - White
  • SUCCESS - Green (custom)
  • WARNING - Yellow
  • ERROR - Red
  • CRITICAL - Red on white

Custom Log Level:

By default, logging is set to INFO level. You can change this by importing and calling setup_colored_logging:

from prettyterm import get_logger, setup_colored_logging
import logging

# Set to DEBUG level to see all messages
setup_colored_logging(log_level=logging.DEBUG)

logger = get_logger("my_app")
logger.debug("This will now be visible")

Development

# Install in editable mode
pip install -e .

# Run examples
python src/prettyterm/pbar.py
python src/prettyterm/table.py
python src/prettyterm/logger.py

License

MIT

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

prettyterm-0.2.4.tar.gz (86.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

prettyterm-0.2.4-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

Details for the file prettyterm-0.2.4.tar.gz.

File metadata

  • Download URL: prettyterm-0.2.4.tar.gz
  • Upload date:
  • Size: 86.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for prettyterm-0.2.4.tar.gz
Algorithm Hash digest
SHA256 6920945cb4dc2b9df4bbd2b81da6e8cf14f7447a8808f9c8ffcd6c51c0778f39
MD5 f79981281541ce3420c9d883dd53c119
BLAKE2b-256 b4062a27e98e37b8fccf88adc840039a6910d1601abe2b856b6bd083e4faf2aa

See more details on using hashes here.

File details

Details for the file prettyterm-0.2.4-py3-none-any.whl.

File metadata

  • Download URL: prettyterm-0.2.4-py3-none-any.whl
  • Upload date:
  • Size: 6.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for prettyterm-0.2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 d8bc1c65be5b74b73251286b76c13f5edc85c36701e43f632c9d6be33c2ecf85
MD5 083649d75e8ce606c1c79b656a875b03
BLAKE2b-256 d33ab60e54c3d735b281cccf11fcae5cd60a3aa866829636b90eb7f2c6005d0f

See more details on using hashes here.

Supported by

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