Skip to content

wanyaoqi/pdir2

 
 

Repository files navigation

pdir2: Pretty dir() printing with joy

Build Status Supported Python versions PyPI Version

Have you ever dreamed of a better output of dir()? I do. So I created this.

Features

  • Attributes are grouped by types/functionalities, with beautiful colors.

  • Support color customization, here's how.

  • Support all platforms including Windows(Thanks to colorama).

  • Support ipython, ptpython, bpython and Jupyter Notebook! See wiki for details.

  • The return value of pdir() can still be used as a list of names.

  • You can search for certain names with .s() or .search():

    Search is case-insensitive by default.
    You can use .search(name, case_sensitive=True) to do case sensitive searching.

Install

pip install pdir2

About the name. I wanted to call it "pdir", but there's already one with this name on pypi. Mine is better, of course.

As a better alternative of dir(), it's more convenient to automatically import pdir2 when launching REPL. Luckily, Python provides a way to do this. In you .bashrc(or .zshrc), add this line:

export PYTHONSTARTUP=$HOME/.pythonstartup

Then, create .pythonstartup in your home folder. Add one line:

import pdir

Next time you launch REPL, pdir() is already there, Hooray!

Testing

Simply run pytest, or use tox if you like.

About

Pretty dir() printing with joy:beer:

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 98.4%
  • Makefile 1.6%