Powerful debugging tool for Python.
Project description
Simple print
Print value with variable name.
Userful for fast debugging.
https://github.com/Sobolev5/simple-print
Install
To install run:
pip install simple-print
Print variables with names
from simple_print import sprint
master = "yoda" # variable name master
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.
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]
f
force print [ignore SIMPLE_PRINT_ENABLED=False for docker production logs for example]
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 error tb
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.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 53092172199c8268ec370d8b5ef7423735706bffc18ca035375a2a262c673d37 |
|
MD5 | 94f5c380604eee1f983ad2c1f658d76c |
|
BLAKE2b-256 | 9531e93657d55614ee40b40bb090bf0b7ce9049d9b05fd73efc5d7156e7de4d6 |