# Overview

The goal of this library is to create a more useful debugging tool than the built-in function `dir`. The core issues of `dir` this library addresses are:

1. Inclusion of dunder methods that are very rarely useful
2. No differentiation between attributes/methods
3. No docstring display
4. No grouping of similar functionality together, only alphabetical sorting

This library takes the output of `dir` and runs the following steps:

1. Groups the attributes and methods by the class they are defined by
   - Identifies the source code location of the class, allowing you to quickly jump to them for a deeper dive in IDEs like VS Code.
   - Prints the docstring summary of the class.
2. Identifies if it is a dunder method, normal method, or attribute
   - Within normal methods, adds a "ᶜ" or "ˢ" to indicate if it is a classmethod or staticmethod rather than a standard instance method.
3. Pulls the summary of the docstring for each attribute/method, if it exists
   - For attributes, there is no `__doc__` attribute, but we follow the convention of [PEP-258](https://www.python.org/dev/peps/pep-0258/) and most autocompletion tools of the next literal expression if it exists
4. Colorizes the output to visually differentiate the classes, attributes, methods, and dunder methods

# Installation

You can install the library using pip:

```bash
pip install pretty-dir
```

# Basic Usage Example

```python
from ppdir import ppdir

class BaseClass:
    base: int

class MyClass(BaseClass):
    a: int
    "example attr docstring"
    b: str

    def my_method(self):
        """This is my method."""
        pass

ppdir(MyClass)
```

# Demo

Running the code in [demo.py](https://github.com/douglassimonsen/ppdir/blob/main/demo.py), you should see the difference between the built-in `dir` and `ppdir` like the following images:

Before:

![before](https://raw.githubusercontent.com/douglassimonsen/ppdir/refs/heads/main/example_images/before.png)

After:

![after](https://raw.githubusercontent.com/douglassimonsen/ppdir/refs/heads/main/example_images/after.png)
