Skip to main content

version badge build coverage badge test badge docs badge commits badge footprint badge Say Thanks!

Rainbow Print

Inspired by Rainbow CSV - Rainbow Print adds colors to the standard outputs to ease the process of monitoring respective data / metrics

Main features

  • Highlights data points in different colors to ease monitoring capabilities
  • By default provides 7 colors (light and dark each) for N Variables(rolling). Supports N colors
  • Support for Dark and Light backgrounds
  • Supports string print based on separator / dictionary's key-value based print
  • Supports custom colors based on sty.fg package
  • Supports use of python logging frameword for advance usecases

Demo

How rainbow print helps

Default print a dictionary of metrics for 10 steps

Dict Print

Default print a string of metrics for 10 steps

Str Print

Rainbow Print - Dark Mode

Rainbow Print Dark

Rainbow Print - Light Mode

Rainbow Print Light

Requirements

  1. python >3
  2. sty

Installation

pip install rainbow-print

Usage

# Print
from rainbow_print import printr
data = {"Episode": 10, "Episode Len":5, "Cost": 0.95, "Reward":135, "Mode":"Explore"}
printr(data)

printr dict

data = f"Episode:{10}, Episode Len:{5}, Cost:{0.95}, Reward:{135}, Mode:{'Explore'}"
printr(data, sep=',')

printr str

# Logging
from rainbow_print import rlogging
logger = rlogging.getLogger(__name__)
data = {"Episode": 10, "Episode Len":5, "Cost": 0.95, "Reward":135, "Mode":"Explore"}
logger.info(data)

logger dict

data = f"Episode:{10}, Episode Len:{5}, Cost:{0.95}, Reward:{135}, Mode:{'Explore'}"
logger.debug(data, sep=',')

logger str

# Get information regarding current configuration
printr.info()
>>Theme: dark
>>Colors: ['\x1b[38;2;5;152;154m', '\x1b[38;2;116;162;103m', '\x1b[38;2;179;128;168m', '\x1b[38;2;255;127;0m', '\x1b[38;2;112;154;180m', '\x1b[38;2;255;255;0m', '\x1b[38;2;255;0;0m']

Configuration

# By default printr works in dark mode
from rainbow_print import printr

# Switch to light palette
printr.set_light_palette()

# Switch to dark palette
printr.set_dark_palette()

# Set colors for dark palette
colors = [sty.fg(0,0,0), sty.fg(255,255,255)]
printr.update_dark_palette(colors)

# Set colors for light palette
colors = [sty.fg(0,0,0), sty.fg(255,255,255)]
printr.update_light_palette(colors)

Metadata

Release files for rainbow-print 1.0.5

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

Source distribution (sdist)

Source distribution for rainbow-print 1.0.5
File Size Uploaded
rainbow-print-1.0.5.tar.gz 7.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for rainbow-print 1.0.5
File Interpreter ABI Platform
rainbow_print-1.0.5-py3-none-any.whl Python 3 none any Details

Total release size: 13.7 kB

Release files / rainbow-print-1.0.5.tar.gz

Download URL rainbow-print-1.0.5.tar.gz
Size 7.9 kB
Tags Source
SHA-256 checksum
How to use checksums
3ccbe37b31c8e2c3f3860534a8078bd1c8d6f881b90ac2d05f9a37f468411d3a
BLAKE2b-256 checksum
How to use checksums
3e25ea6bcb410307b8ccc12472703d724e0300ac07721d7b87c7e798fe88f435
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/46.0.0.post20200309 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6

Release files / rainbow_print-1.0.5-py3-none-any.whl

Download URL rainbow_print-1.0.5-py3-none-any.whl
Size 5.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
09607b38a09ee0653be9b3719dd029626c7716451492d28f6e27defd0d5b422a
BLAKE2b-256 checksum
How to use checksums
f1323f43ddd76df0452c11ac06ff9b79ed77851e9badea7da6d847a798cc6544
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3

Release history Release notifications | RSS feed

This release

1.0.5 This release

2 release files

1.0.4

1 release file

1.0.3

1 release file

1.0.2

1 release file

1.0.1

2 release files

1.0.0

1 release file

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