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
# Old style (v1)
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")}')
# New v2 style
from prettier_prints.prettier_printsv2 import Output
pp = Output()
print(f"\n{pp.msg('Hello').red().bold().underline()}")
print(f"{pp.msg('Hello').green().bold().out()}")
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 (v1 style):
- 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-3.0.0.tar.gz
(5.2 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file prettier_prints-3.0.0.tar.gz.
File metadata
- Download URL: prettier_prints-3.0.0.tar.gz
- Upload date:
- Size: 5.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5715fb52d2e876ba768cb4116729f3e65e79a3d0ec7cbac7a3b4a355cf4a3f93
|
|
| MD5 |
2c74bec0ed6b45ffc01b0ca243226b54
|
|
| BLAKE2b-256 |
b468181b5c02552bc6f0d43f5db2dc2846acdfbd42e7dce82d95f0a5958f8b33
|
File details
Details for the file prettier_prints-3.0.0-py3-none-any.whl.
File metadata
- Download URL: prettier_prints-3.0.0-py3-none-any.whl
- Upload date:
- Size: 6.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.19
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
551700d6e495419e5be081d80747bbca5889ccafd015d3b7e3446a4b0d63dfe8
|
|
| MD5 |
58710a786686c0db804bca82e800aff3
|
|
| BLAKE2b-256 |
08f9299191548623ce782f25aca1cfc6ebf5f9a69014cef98bd5d6f2d6ec3c5f
|