Simple print
Local development tool for logs printing.
https://github.com/Sobolev5/simple-print
Install
To install run:
pip install simple-print
Features
- Variable value on the first line, metadata (type, file, line, function, time) on the second line
- Clickable file paths in terminal output — Cmd+click (macOS) or Ctrl+click (Linux/Windows) to jump to source
- Colors, backgrounds, attributes, indentation
sprint
Print variables with its 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
ccolor [grey, red, green, yellow, blue, magenta, cyan, white].
bbackground [on_grey, on_red, on_green, on_yellow, on_blue, on_magenta, on_cyan].
aattribute [bold, dark, underline, blink, reverse, concealed].
ppath [True/False] with path to file.
llight [True/False] print without fn name and lineno (shortcut lprint).
iindent [1..40].
sstring [True/False] return as string.
rreturn [True/False] print and return as string.
fforce print [True/False] ignore SIMPLE_PRINT_ENABLED=False for docker production logs for example.
streamoutput stream [stdout, stderr, null]. stdout by default. null means no print.
Example with indent
Indent print:
def test_indent():
fruits = ["lemon", "orange", "banana"]
sprint(fruits, c="green")
for fruit in fruits:
sprint(fruit, c="yellow", i=4)
lprint
Light version of sprint (no metadata line). Also available as lsprint for backward compatibility.
master = "yoda" # variable name master
lprint(master)
SprintErr
Minified error traceback with box frame.
from simple_print import SprintErr
bob = []
with SprintErr(l=30):
bob[2] # pretty error traceback (show 30 lines)
spprint
Pretty print dict with box frame.
from simple_print import spprint
spprint({"hello": "world", "lorem": "ipsum"})
spprint({"hello": "world", "lorem": "ipsum"}, i=20) # with indent
Env
Stop printing on production:
export SIMPLE_PRINT_ENABLED=False
Test
pytest -s
Metadata
Release files for simple-print 2.2.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| simple_print-2.2.8.tar.gz | 8.6 kB | Without provenance | Details for simple_print-2.2.8.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| simple_print-2.2.8-py3-none-any.whl | Python 3 | none | any | Details for simple_print-2.2.8-py3-none-any.whl |
Total release size: 16.3 kB
Release files / simple_print-2.2.8.tar.gz
| Download URL | simple_print-2.2.8.tar.gz |
|---|---|
| Size | 8.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b53bc38aa8690d71030dfc47b6c57075e61ec957ad3f44d6fdc178dd787dfbbc
|
|
BLAKE2b-256 checksum How to use checksums |
9559f01e84b453059e20ef1b46d0b356c8b8303d69c2f125e35f8ed988f0dea0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.2
|
Release files / simple_print-2.2.8-py3-none-any.whl
| Download URL | simple_print-2.2.8-py3-none-any.whl |
|---|---|
| Size | 7.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a525f25820cb105be8a2887da09d5a62a903910cf95b6c0480cb07b964dce67e
|
|
BLAKE2b-256 checksum How to use checksums |
c943f378508a77e2a25423a68adef9075c2ff57bc19a851c54ac5ddfc043a2fd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.2
|
Security for simple-print 2.2.8
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.