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.fgpackage - 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)
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)
| File | Size | Uploaded | |
|---|---|---|---|
| rainbow-print-1.0.5.tar.gz | 7.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| 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
|