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
Full example you can see here.
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
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]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]. stdout by default.
Example with indent
For indent use i
param. Full example you can see here.
def test_indent():
fruits = ["lemon", "orange", "banana"]
sprint(fruits, c="green")
for fruit in fruits:
sprint(fruit, c="yellow", i=4)
Pretty error tb
Show last 20 error_tb lines (useful for large error tb):
from simple_print import SprintErr
with SprintErr(l=20):
some_broken_code / 0
ENV
Stop printing:
export SIMPLE_PRINT_ENABLED=False
Always show path to file:
export SIMPLE_PRINT_SHOW_PATH_TO_FILE=True
Add linebreak to every print:
export SIMPLE_PRINT_ADD_LINE_BREAK=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.9.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d84294b2177807cddee8f953109e1c27166d71887394bba0cb814f5168713c40 |
|
MD5 | ed12285e461a3aac9718d3ff26045576 |
|
BLAKE2b-256 | d12718a4fcfc447bd019e0c9449bd4415d0767f0a30c81420199a471ce78d2c5 |