--- id: astunparse version: "1.6.3" license: BSD license_treatment: permissive maintenance: abandoned --- # astunparse — An AST unparser for Python License: permissive · Maintenance: abandoned · Downloads: 14.0M/mo ## What it is and what it does astunparse is a library that converts Python AST (abstract syntax tree) objects back into readable source code and provides a pretty-printed dump of AST structure. It factors out the unparse utility from Python's standard library, making it available as a standalone package. The library is built on mature, core-maintained code from the Python source distribution and roundtrips much of the standard library. It depends only on wheel and six, making installation straightforward. However, the project is abandoned—last updated 2019-12-22—so it will not receive updates for newer Python versions or syntax features. Use it for: - Recover source code from compiled or introspected AST objects for debugging or code analysis. - Generate readable Python code from programmatically constructed AST trees in code generation tools. - Pretty-print AST structure for educational purposes or to understand how Python parses code. - Roundtrip Python source through parse and unparse cycles to verify AST fidelity in testing. - Implement metaprogramming tools that need to display or manipulate AST as human-readable code. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Converts Python abstract syntax trees (ASTs) back into source code and provides pretty-printed AST dumps. Yes, if you work with Python versions supported at the last release (2019-12-22) and need reliable AST-to-source conversion. The code is stable and well-tested. No if you require support for newer Python versions—the abandoned status means no updates are coming. Consider alternatives if you need active maintenance. ## Install pip install astunparse uv add astunparse poetry add astunparse ## Installing astunparse Before you install: Low friction install with minimal dependencies (wheel, six). Maintenance is abandoned—last release was 2019-12-22 and last commit 2023-08-18—so expect no active bug fixes or support for newer Python versions. License in practice: BSD license is permissive; you can use, modify, and distribute this code with minimal restrictions, though you must retain the license notice. Quickstart: import ast import astunparse code = "x = 1 + 2" tree = ast.parse(code) print(astunparse.unparse(tree)) print(astunparse.dump(tree)) Abandoned since 2019-12-22; no updates for Python versions beyond those listed in classifiers. May not handle newer syntax features. Verify before relying: - Compatibility with Python versions released after 2019-12-22 and AST node types introduced after that date. - Whether roundtrip fidelity is maintained for Python constructs added after the last release. ## Package facts - License: BSD (permissive) - Python support: unspecified - Install friction: low - Maintenance: abandoned - Downloads: 14.0M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags ast to source code, unparse python ast, ast pretty print, python code generation from ast, ast roundtrip, dump ast tree, ast serialization, ast-manipulation, code-generation, legacy [View on SkillFed](https://skillfed.io/packages/astunparse) · [View on PyPI](https://pypi.org/project/astunparse/)