Lightweight library for prettier terminal outputs and debugging similar to chalk for Javascript
Project description
Prettier_prints
Lightweight library for prettier terminal outputs similar to chalk for JavaScript. Helping make Python outputs easier to read and styled to your desires.
Install
pip install prettier-prints
Examples: out()
from prettier_prints.prettier_prints import PrettierPrints
pp = PrettierPrints()
pp.style = 'red;underline' # <-- Can optionally predefine styling and can be overwritten
print(pp.out(msg="Lets test the output"))
print(pp.out(msg="Lets override the styling here", style="blue;bold"))
print(pp.out(json_out={'msg': 'For those who prefer a JSON object param, this works too'}))
print(pp.out(json_out={'msg': 'Can also overwrite this way', 'style': 'yellow;highlight'}))
print(f'Works great for output messages as well -> {pp.out(msg="See :)", style="magenta")}')
json()
from prettier_prints.prettier_prints import PrettierPrints
pp = PrettierPrints()
json_obj = {'test': 'cool', 'test_two': 'cool_two', 'dict_check': {'test': 'hello'},
'list_check': [
'test',
'test two',
{
'test': 'hello',
'test_two': 'bloop'
},
{
'test': 'hello',
'test_two': 'bloop'
}
]}
print(prettier_prints.json(json_obj=json_obj, style='list=blue;underline&dict=red;bold&string=green;'))
Current functions:
- out()
- json()
Function parameters:
- out()
- msg: str Output / display message[required]
- style: str Styling to apply to the message[optional]
- json_out: dict JSON object containing the message and styling[optional]
- json()
- style: str Styling to apply to the message[optional]
- json_obj: dict JSON object containing the message and styling[required]
Styling Examples By Function:
- out()
- style: 'red;underline'
- json_out: {'msg': 'Lets test the output', 'style': 'blue;bold'}
- json()
- style: 'list=red;underline&dict=blue;bold&str=yellow;highlight' # <- Break up the styling by type (list, dict, str)
Current available styling:
Modifiers | Colors / Background Colors |
---|---|
Bold | Red |
Underline | Green |
Highlight | Yellow |
Blue | |
Magenta | |
Cyan | |
White | |
Bright Red | |
Bright Green | |
Bright Yellow | |
Bright Blue | |
Bright Magenta | |
Bright Cyan | |
Bright White |
Contributors / Thanks:
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
prettier_prints-2.0.2.tar.gz
(4.8 kB
view hashes)
Built Distribution
Close
Hashes for prettier_prints-2.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1b559e651229891748d594ad912b743f7c03b220769044a1333759a16ee10874 |
|
MD5 | ff9f7bdf8d514b570af7cec1413d1591 |
|
BLAKE2b-256 | 4158cf166a9c37bb5b74441118e478ff6f5a9cd447cf23775a31f61f93a17a40 |