Skip to main content

Useful console tools for local development

Project description

Simple print

Collection of console print utilities.
Userful for local development.

https://github.com/Sobolev5/simple-print

Install

To install run:

pip install simple-print

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 

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 [True/False] with path to file. l light [True/False] print without fn name and lineno (shortcut lsprint). i indent [1..40]. s string [True/False] return as string. r return [True/False] print and return as string. f force print [True/False] 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

Indent print:

def test_indent():
    fruits = ["lemon", "orange", "banana"]
    sprint(fruits, c="green")  
    for fruit in fruits:
        sprint(fruit, c="yellow", i=4)

lsprint

Light version of sprint.

master = "yoda" # variable name master
lsprint(master)
   

SprintErr

Minified error traceback.

from simple_print import SprintErr

@patch("logging.info", MagicMock(side_effect=[Exception("Something went wrong")]))
def test_sprint_err(self):
   with SprintErr(l=30):
      logging.info("")
  

spprint

Pretty print with indent.

from simple_print import sprrint

spprint(
   {"hello": c"world", "lorem": "ipsum"}, 
   i=20,
)
  

ArtEnum 🚀 collection of ascii Art

from simple_print import ArtEnum

print(ArtEnum.PACMAN_1)

Env

Stop printing on production:

export SIMPLE_PRINT_ENABLED=False

Test

tox

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

simple_print-2.2.3-py3-none-any.whl (13.4 kB view details)

Uploaded Python 3

File details

Details for the file simple_print-2.2.3-py3-none-any.whl.

File metadata

  • Download URL: simple_print-2.2.3-py3-none-any.whl
  • Upload date:
  • Size: 13.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.11.6

File hashes

Hashes for simple_print-2.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 1834e86459e63b45d49bd72294e3bdfea716c949e797e6ebbca6f5d6e3c469ea
MD5 de6903ddd275be3084e826bacf64b7ff
BLAKE2b-256 06f4337f065d5268c12d6b8ef4b21f03d368998475a72dd528b1158fd8892973

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page