pprintast
An AST (abstract syntax tree) pretty printer for Python 🐍.
Installation
$ pip install pprintast
Usage
usage: pprintast.py [-h] [-a] [-c cmd] [-m mode] [-t] [-v] [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 passed in as file
optional arguments:
-h, --help show this help message and exit
-a, --attributes include attributes such as line numbers and column offsets
-c cmd, --command cmd program passed in as string
-m mode, --mode mode compilation mode (choices: exec, eval, single) (default: exec)
-t, --terse terse output by disabling field annotations
-v, --version show program's version number and exit
Script
Pretty print AST from a file using the pprintast CLI.
$ pprintast "./path/to/script.py"
Pretty print AST from a string using the pprintast CLI.
$ pprintast -c "lambda a: a**2"
Module
Pretty print AST from a string using the pprintast module.
# 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)
License
MIT © Travis Clarke
Metadata
Release files for pprintast 1.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pprintast-1.2.1.tar.gz | 4.5 kB | Without provenance | Details for pprintast-1.2.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pprintast-1.2.1-py3-none-any.whl | Python 3 | none | any | Details for pprintast-1.2.1-py3-none-any.whl |
Total release size: 10.8 kB
Release files / pprintast-1.2.1.tar.gz
| Download URL | pprintast-1.2.1.tar.gz |
|---|---|
| Size | 4.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2b93e936c559cb5765d01eeef84770a41b0538e36ec2a5c76969f542d17c6cf2
|
|
BLAKE2b-256 checksum How to use checksums |
c6992984c30abf587694efe6facc258a4403280550a6d16bd684a2164980df3f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.29.1 CPython/3.7.2
|
Release files / pprintast-1.2.1-py3-none-any.whl
| Download URL | pprintast-1.2.1-py3-none-any.whl |
|---|---|
| Size | 6.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
385f4839e19f08dd0205485ed88a2fd9013275057c841d186636c6b6495dc971
|
|
BLAKE2b-256 checksum How to use checksums |
924c0a64abd0b21939d5804b951c53ad3777b2c0edaf512b5106394b694639cd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.29.1 CPython/3.7.2
|
Security for pprintast 1.2.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.