Useful console tools for local development
Project description
Simple print
Collection of console debug utilities.
Userful for local development.
https://github.com/Sobolev5/simple-print
Install
To install run:
pip install simple-print
sprint 🚀 print variables with names
master = "yoda" # variable name master
sprint(master)
sprint(master, c="magenta")
sprint(master, c="white", b="on_blue")
sprint(master, c="blue", b="white", a="underline")
sprint(master, c="blue", b="on_white", a="bold", p=True)
master_as_s = sprint(master, s=True) # return as string
master_as_s_with_path = sprint(master, s=True, p=True) # return as string with path to file
Fn params:
c
color [grey, red, green, yellow, blue, magenta, cyan, white]
b
background [on_grey, on_red, on_green, on_yellow, on_blue, on_magenta, on_cyan]
a
attribute [bold, dark, underline, blink, reverse, concealed]
p
path [with path to file]
i
indent [indent 1..40]
s
string [return as string]r
return [print and return as string]f
force print [ignore SIMPLE_PRINT_ENABLED=False for docker production logs for example]
stream
output stream [stdout, stderr, null]. stdout by default. null means no print.
Example with indent
def test_indent():
fruits = ["lemon", "orange", "banana"]
sprint(fruits, c="green")
for fruit in fruits:
sprint(fruit, c="yellow", i=4)
SprintErr 🚀 minified error traceback
Show last 20 error_tb lines (useful for large error tb):
from simple_print import SprintErr
with SprintErr(l=20):
some_broken_code / 0
spprint 🚀 pretty print with indent
Show last 20 error_tb lines (useful for large error tb):
from simple_print import sprrint
spprint({"hello": c"world", "lorem": "ipsum"}, i=20)
{
'hello': 'world',
'lorem': 'ipsum'
}
ArtEnum 🚀 collection of ascii Art
from simple_print import ArtEnum
print(ArtEnum.PACMAN_1)
,##. ,==.
,# #. \ o ',
# # _ _ \ \
# # (_) (_) / ;
`# #' / .'
`##' "=="
Env
Stop printing on production:
export SIMPLE_PRINT_ENABLED=False
Test
tox
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 Distributions
Built Distribution
Hashes for simple_print-2.2.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3e61b576d8d18fa864dcae01c72d510ef0d9b082c114f9f8fa0d9e4668eae5f2 |
|
MD5 | 20f98da90b7b4d83db5fc15602d5b278 |
|
BLAKE2b-256 | 46686ad43922521753043b1bdf8a4bfd225423352d070521cabb5473dd15ee5e |