Metadata-Version: 2.1
Name: pprintast
Version: 0.0.2
Summary: A AST pretty printer for python.
Home-page: https://github.com/clarketm/pprintast
Author: Travis Clarke, Alex Leone
Author-email: travis.m.clarke@gmail.com, acleone@gmail.com
License: UNKNOWN
Platform: UNKNOWN
Classifier: Intended Audience :: Developers
Classifier: Natural Language :: English
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Environment :: Console
Description-Content-Type: text/markdown

# [pprintast](https://pypi.org/project/pprintast/)

[![PyPi release](https://img.shields.io/pypi/v/pprintast.svg)](https://pypi.org/project/pprintast/)

An AST (abstract syntax tree) pretty printer for Python 🐍.

## Installation

```bash
$ pip install pprintast
```

## Usage

```text

usage: pprintast.py [-h] [-v] [-c cmd] [file]

A pretty-printing dump function for the ast module. The code was copied from
the ast.dump function and modified slightly to pretty-print.

positional arguments:
  file                   program(s) passed in as file

optional arguments:
  -h, --help             show this help message and exit
  -v, --version          show program's version number and exit
  -c cmd, --command cmd  program passed in as string

```

### Script

Pretty print AST from a **file** using the `pprintast` CLI.

```bash
$ pprintast "./path/to/script.py"
```

Pretty print AST from a **string** using the `pprintast` CLI.

```bash
$ pprintast -c "lambda a: a**2"
```

### Module

Pretty print AST from a **string** using the `pprintast` module.

```python

# 1. import the "pprintast" function.
from pprintast import pprintast as ppast # OR: from pprintast import ppast

# 2. pretty print AST from a "string".
exp = "lambda a: a**2"

ppast(exp)

```

![stdout](https://raw.githubusercontent.com/clarketm/pprintast/master/pprintast.png)

## License

MIT &copy; [**Travis Clarke**](https://blog.travismclarke.com/)


