--- id: google-pasta version: "0.2.0" license: Apache 2.0 license_treatment: permissive maintenance: abandoned --- # google-pasta — pasta is an AST-based Python refactoring library License: permissive · Maintenance: abandoned · Popularity: top 1,000 on PyPI ## Install pip install google-pasta uv add google-pasta poetry add google-pasta ## Description # pasta: **P**ython **AST** **A**ugmentation *This is still a work-in-progress; there is much more to do. Existing functionality may not be perfect.* ## Mission Enable python source code refactoring through AST modifications. Sample use cases: * Facilitate moving or renaming python modules by rewriting import statements. * Refactor code to enforce a certain style, such as reordering function definitions. * Safely migrate code from one API to another. ## Design Goals * **Symmetry**: Given any input source, it should hold that `pasta.dump(pasta.parse(src)) == src`. * **Mutability**: Any changes made in the AST are reflected in the code generated from it. * **Standardization**: The syntax tree parsed by pasta will not introduce new nodes or structure that the user must learn. ## Python Version Support Supports python `2.7` and up to `3.8`. ## Dependencies `pasta` depends on [`six`](https://pypi.org/project/six/). ## Basic Usage ```python import pasta tree = pasta.parse(source_code) # ... Augment contents of tree ... source_code = pasta.dump(tree) ``` ## Built-in Augmentations Pasta includes some common augmentations out-of-the-box. These can be used... [View on SkillFed](https://skillfed.io/packages/google-pasta) · [View on PyPI](https://pypi.org/project/google-pasta/)