A new kind of Progress Bar, with real-time throughput, ETA, and very cool animations!
—
Quality
Pending
Does it follow best practices?
Impact
Pending
No eval scenarios have been run
Development and debugging utilities for character discovery and terminal testing. These tools are primarily useful for developers creating custom animations, testing Unicode support, and debugging terminal rendering issues.
Utility for exploring Unicode characters available in the terminal, particularly useful for finding special characters for custom spinners and progress bars.
def print_chars(line_length: int = 32, max_char: int = 0x20000):
"""
Print all Unicode characters in the terminal to help find characters for custom animations.
Useful for determining which characters your terminal supports and finding cool characters
to use in custom spinners or bars.
Parameters:
- line_length (int): Number of characters per line in output (default: 32)
- max_char (int): Last character in Unicode table to display (default: 0x20000)
Maximum value is 0x10ffff. Values above the default often show
as question marks, but can be increased to explore more ranges.
Returns:
None (prints output directly to terminal)
"""Basic Character Exploration:
from alive_progress.tools import print_chars
# Print all basic Unicode characters
print_chars()
# Output format:
# 0x00020: ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ?
# 0x00040: @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _
# 0x00060: ` a b c d e f g h i j k l m n o p q r s t u v w x y z { | } ~
# ...Custom Line Length:
# Shorter lines for narrow terminals
print_chars(line_length=16)
# Longer lines for wide terminals
print_chars(line_length=64)Specific Unicode Ranges:
# Explore basic Latin and symbols (faster)
print_chars(max_char=0x1000)
# Explore more Unicode planes (slower, more comprehensive)
print_chars(max_char=0x30000)
# Full Unicode exploration (very slow)
print_chars(max_char=0x10ffff)Finding Animation Characters:
from alive_progress.tools import print_chars
from alive_progress.animations import frame_spinner_factory
from alive_progress import alive_bar
# Explore Unicode to find interesting characters
print_chars(max_char=0x3000) # Look for symbols
# Test discovered characters in actual spinner
discovered_chars = ['◐', '◓', '◑', '◒'] # Found from exploration
test_spinner = frame_spinner_factory(discovered_chars)
# Test in progress bar
with alive_bar(100, spinner=test_spinner, title='Testing Characters') as bar:
for i in range(100):
bar()
time.sleep(0.05)Common usage patterns for testing terminal capabilities and character rendering.
from alive_progress.tools import print_chars
# Test basic Unicode blocks
print("Testing Basic Latin Extended:")
print_chars(line_length=16, max_char=0x300)
print("\nTesting Symbols and Arrows:")
print_chars(line_length=16, max_char=0x2800)
print("\nTesting Box Drawing Characters:")
print_chars(line_length=16, max_char=0x2600)from alive_progress.tools import print_chars
import re
# Function to help identify useful spinner characters
def find_spinner_chars():
"""Explore and test potential spinner characters."""
print("=== BASIC GEOMETRIC SHAPES ===")
# Unicode block: Geometric Shapes (U+25A0–U+25FF)
for i in range(0x25A0, 0x2600, 16):
print(f'0x{i:05x}:', end=' ')
for j in range(16):
if i + j <= 0x25FF:
try:
print(chr(i + j), end=' ')
except UnicodeEncodeError:
print('?', end=' ')
print()
print("\n=== BRAILLE PATTERNS ===")
# Unicode block: Braille Patterns (U+2800–U+28FF)
for i in range(0x2800, 0x2900, 16):
print(f'0x{i:05x}:', end=' ')
for j in range(16):
if i + j <= 0x28FF:
try:
print(chr(i + j), end=' ')
except UnicodeEncodeError:
print('?', end=' ')
print()
# Run the discovery
find_spinner_chars()from alive_progress.tools import print_chars
def find_bar_chars():
"""Explore characters suitable for progress bars."""
print("=== BLOCK ELEMENTS ===")
# Unicode block: Block Elements (U+2580–U+259F)
for i in range(0x2580, 0x25A0, 8):
print(f'0x{i:05x}:', end=' ')
for j in range(8):
if i + j <= 0x259F:
try:
char = chr(i + j)
print(f'{char} ', end='')
except UnicodeEncodeError:
print('? ', end='')
print()
print("\n=== BOX DRAWING ===")
# Unicode block: Box Drawing (U+2500–U+257F)
for i in range(0x2500, 0x2580, 16):
print(f'0x{i:05x}:', end=' ')
for j in range(16):
if i + j <= 0x257F:
try:
print(chr(i + j), end=' ')
except UnicodeEncodeError:
print('?', end=' ')
print()
find_bar_chars()Using character discovery results with animation creation tools.
from alive_progress.tools import print_chars
from alive_progress.animations import frame_spinner_factory, bar_factory
from alive_progress import alive_bar
import time
# Step 1: Discover characters
print("Exploring Braille patterns for spinner:")
print_chars(line_length=16, max_char=0x28FF)
# Step 2: Select interesting characters based on output
braille_chars = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏']
# Step 3: Create spinner with discovered characters
custom_spinner = frame_spinner_factory(braille_chars)
# Step 4: Test in progress bar
print("\nTesting discovered characters:")
with alive_bar(50, spinner=custom_spinner, title='Custom Braille Spinner') as bar:
for i in range(50):
time.sleep(0.1)
bar()
# Step 5: Discover bar characters
print("\nExploring block elements for bars:")
print_chars(line_length=8, max_char=0x259F)
# Step 6: Create custom bar
block_chars = ['▁', '▂', '▃', '▄', '▅', '▆', '▇', '█']
custom_bar = bar_factory(chars=block_chars, background='░')
# Step 7: Test custom bar
print("\nTesting custom bar:")
with alive_bar(50, bar=custom_bar, spinner=custom_spinner, title='Custom Bar & Spinner') as bar:
for i in range(50):
time.sleep(0.1)
bar()Using print_chars to diagnose terminal rendering problems.
from alive_progress.tools import print_chars
import os
import sys
def diagnose_terminal():
"""Diagnose terminal Unicode support."""
print(f"Terminal type: {os.getenv('TERM', 'unknown')}")
print(f"Python version: {sys.version}")
print(f"Stdout encoding: {sys.stdout.encoding}")
print()
# Test basic ASCII
print("=== ASCII TEST (should work everywhere) ===")
print_chars(line_length=16, max_char=0x80)
# Test extended characters
print("\n=== EXTENDED CHARACTERS TEST ===")
print_chars(line_length=16, max_char=0x300)
# Test symbols that alive-progress commonly uses
print("\n=== ALIVE-PROGRESS COMMON SYMBOLS ===")
common_symbols = ['│', '█', '▌', '▊', '▋', '●', '○', '◐', '◑', '◒', '◓', '⠋', '⠙', '⠹', '⠸']
for i, char in enumerate(common_symbols):
if i % 8 == 0:
print()
try:
print(f'{char} ', end='')
except UnicodeEncodeError:
print('? ', end='')
print("\n")
# Run diagnosis
diagnose_terminal()Install with Tessl CLI
npx tessl i tessl/pypi-alive-progress