Package: peepshow
peepshowProvides following utilities for debugging Python applications:show - lightweight function that prints name and value of your variable(s) to the console.peep - featured, interactive interface for data inspection.ResourcesDocumentation:https://gergelyk.github.io/peepshowRepository:https://github.com/gergelyk/peepshowPackage:https://pypi.python.org/pypi/peepshowAuthor:Grzegorz KrasońLicense:MITInstallationInstallpeepshowpackage:pipinstallpeepshowPeepShow usesclear,vim,mancommands which are available in most of Linux distributions. Users of other operating systems need to install them on their own.Built-InsIf you expect to use peepshow often, consider addingpeepandshowcommands to Python's built-ins and enabling except hook. Edit either{site-packages}/sitecustomize.pyor{user-site-packages}/usercustomize.pyand append the following:importpeepshowimportbuiltinsbuiltins.peep=peepshow.peepbuiltins.show=peepshow.showbuiltins.peep_=peepshow.peep_builtins.show_=peepshow.show_peepshow.enable_except_hook(consider_env=True)BreakpointIt is also possible to invokepeep()as a result of calling built-in functionbreakpoint(). To enable such behavior usePYTHONBREAKPOINTsystem variable:exportPYTHONBREAKPOINT=peepshow.peepCompatibilityThis software is expected to work with Python 3.6, 3.7, 3.8 and compatible.It has never been tested under operating systems other than Linux.It works fine when started in a plain Python script, in ipython or ptipython.In these environments like interactive python console, in pdb and ipdb, peep and show cannot infer names of the variables in the user context, so they need to be provided explicitly (e.g. usepeep_andshow_).UsageshowRunning this script:x=123y={'name':'John','age':123}z="Hello World!"# show all the variables in the scopeshow()# or only variables of your choiceshow(x,y)# you can also rename themshow(my_var=x)# use 'show_' to specify variable names as a stringshow_('x')# expressions and renaming are also allowedshow_('x + 321',zet='z')will result in following output:x = 123
y = {'age': 123, 'name': 'John'}
z = 'Hello World!'
x = 123
y = {'age': 123, 'name': 'John'}
my_var = 123
x = 123
x + 321 = 444
zet = 'Hello World!'peepTry running the following script:x=123y={'name':'John','age':123}z="Hello World!"# inspect dictionary that consists of all the variables in the scopepeep()# or inspect variable of your choice directlypeep(x)# use 'peep_' to specify variable name as a stringpeep_('x')When interactive interface pops up:Hit ENTER to see list of available variables.Type10and hit ENTER to selecty.Hit ENTER again to see items of your dictionary.Typedirand hit ENTER to list attributes ofy(excluding built-ins).Typecontinueand hit ENTER to proceed or typequitand hit ENTER to terminate your script.Note that all the commands have their short aliases. E.g.quitandqis the same.For more help:Typehelpand hit ENTER to see list of available commands.Typemanand hit ENTER to read the manual, hitqwhen you are done.excepthookBefore running your script, set environment variablePYTHON_PEEP_EXCEPTIONSto1. Now run the script and see what happens when an exception is raised.Development# Preparing environmentpipinstall--userpoetry# unless already installedpoetryinstall# Auto-formattingpoetryrundocformatter-ripeepshowtests
poetryrunisort-rcpeepshowtests
poetryrunyapf-r-ipeepshowtests# Checking coding stylepoetryrunflake8peepshowtests# Checking composition and qualitypoetryrunvulturepeepshowtests
poetryrunmypypeepshowtests
poetryrunpylintpeepshowtests
poetryrunbanditpeepshowtests
poetryrunradonccpeepshowtests
poetryrunradonmipeepshowtests# Testing with coveragepoetryrunpytest--covpeepshow--covtests# Rendering documentationpoetryrunmkdocsserve# Building packagepoetrybuild# Releasingpoetryversionminor# increment selected componentgitcommit-am"bump version"gitpush
gittag${$(poetryversion)[2]}gitpush--tags
poetrybuild
poetrypublish
poetryrunmkdocsbuild
poetryrunmkdocsgh-deploy-bgh-pagesDonationsIf you find this software useful and you would like to repay author's efforts you are welcome to use following button: