Â
A colorful CLI object inspector for python
peep dis (verb phrase, imperative): "Check this out" or "Hey! Have a look at this."
Overview • Features • Usage • Upcoming Features
Overview
Features
- Evaluate and color codes attributes and callables
- Duplicates object to avoid state alterations
- Choose whether builtin and private attributes and methods are included
- Attempt to forge arguments from type hints (in development)
- Allow user specified arguments (in development)
Usage
pip install peepdis
Import
from peepdis import peep
Peep external objects
import pandas as pd
df = pd.DataFrame({'a': [1, 2, 3], 'b': [4, 5, 6]})
peep(df)
Peep your own objects
class Square:
def __init__(self, a, b, name=None):
self.a = a
self.b = b
self.name = name
def ratio(self):
return self.a / self.b
def area(self):
return self.a * self.b
sq = Rect(4, 4)
peep(sq)
Include builtins (i.e. dunders)
peep(sq, builtins=True)
Include private attributes and methods
peep(sq, privates=True)
Print docstrings with output
peep(sq, docstrings=True)
Include long outputs (truncates at 250 char by default)
peep(sq, truncate_len=None)
Use in debugger
(Pdb) print(peep(sq))
Upcoming Features
- Include/exclude private methods and attributes
- Detect and display resultant state changes
- User specified arguments
- Argument forging from type hints, docstrings, or by brute force
- Optionally include docstrings
- Modify color scheme and other preferences