Rainbow Print adds colors to the standard outputs to ease the process of monitoring respective data / metrics
Project description
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
Default print a string of metrics for 10 steps
Rainbow Print - Dark Mode
Rainbow Print - Light Mode
Requirements
- python >3
- 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)
data = f"Episode:{10}, Episode Len:{5}, Cost:{0.95}, Reward:{135}, Mode:{'Explore'}"
printr(data, sep=',')
# 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)
data = f"Episode:{10}, Episode Len:{5}, Cost:{0.95}, Reward:{135}, Mode:{'Explore'}"
logger.debug(data, sep=',')
# 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)
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
rainbow-print-1.0.5.tar.gz
(7.9 kB
view details)
Built Distribution
File details
Details for the file rainbow-print-1.0.5.tar.gz
.
File metadata
- Download URL: rainbow-print-1.0.5.tar.gz
- Upload date:
- Size: 7.9 kB
- Tags: Source
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
3ccbe37b31c8e2c3f3860534a8078bd1c8d6f881b90ac2d05f9a37f468411d3a
|
|
MD5 |
581e778dd1023319874073657b21bc11
|
|
BLAKE2b-256 |
3e25ea6bcb410307b8ccc12472703d724e0300ac07721d7b87c7e798fe88f435
|
File details
Details for the file rainbow_print-1.0.5-py3-none-any.whl
.
File metadata
- Download URL: rainbow_print-1.0.5-py3-none-any.whl
- Upload date:
- Size: 5.8 kB
- Tags: Python 3
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
09607b38a09ee0653be9b3719dd029626c7716451492d28f6e27defd0d5b422a
|
|
MD5 |
4a0f28961c91c62a27173661bc06e62b
|
|
BLAKE2b-256 |
f1323f43ddd76df0452c11ac06ff9b79ed77851e9badea7da6d847a798cc6544
|