Powerful debugging tool for Python.
Project description
Simple print
Powerful debugging tool for Python.
Userful for bash
console messages.
https://github.com/Sobolev5/simple-print
Install
To install run:
pip install simple-print
Print variables
Function 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]
f
force print [ignore SIMPLE_PRINT_ENABLED=False for docker production logs for example]
from simple_print import sprint
master = "yoda"
sprint(master)
sprint(master, c="blue")
sprint(master, c="blue", b="on_white")
sprint(master, c="blue", b="on_white", a="underline")
sprint(master, c="blue", b="on_white", a="bold", p=True)
my_string = sprint(master, s=True) # return as string
my_string = sprint(master, s=True, p=True) # return as string with path to file
Result:
p
param is False
by default, but you can override this behavior with SIMPLE_PRINT_PATH_TO_FILE=True
in your local environment.
Example with indent
For indent use i
param:
def test_indent():
fruits = ["lemon", "orange", "banana"]
sprint(fruits, c="green")
for fruit in fruits:
sprint(fruit, c="yellow", i=4)
Result:
Pretty errors
Show errors with pretty traceback:
from simple_print import SprintErr
with SprintErr():
raise ValueError
ENV
Stop printing:
export SIMPLE_PRINT_ENABLED=False
Always show path to file:
export SIMPLE_PRINT_SHOW_PATH_TO_FILE=True
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-1.7.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a6930a7d63dbf9a8364ce0e3b17cd0f3a081107f05c1d2b178e0ff1c570cba6f |
|
MD5 | dca794d65c08967861106c3497b28087 |
|
BLAKE2b-256 | 1d8bb0856b1ebeb091110ccb83a6355c556b9da146336cdff8608d0f8969e2ec |