--- id: ast-decompiler version: "0.8.0" license: unclear license_treatment: permissive maintenance: active --- # ast-decompiler — Python module to decompile AST to Python code License: permissive · Maintenance: active · Downloads: 176.0K/mo ## What it is and what it does ast_decompiler takes a Python AST object and generates human-readable Python source code from it. This is useful when you have parsed code as an AST (via ast.parse or similar) and need to recover or inspect the original source, or when you're working with dynamically constructed ASTs and want to see what code they represent. The package supports Python 3.8 through 3.13 and has no runtime dependencies, making it lightweight to integrate. It is actively maintained with recent activity, and the codebase is formatted with Black. The module is straightforward to use: pass an AST node to the decompile function and receive a string of reconstructed Python code. Use it for: - Debug or inspect dynamically generated or modified ASTs by converting them back to readable code. - Implement code transformation tools that need to display or log the result of AST modifications. - Build educational tools or documentation that show how Python code maps to its AST representation. - Generate test fixtures or example code from programmatically constructed AST objects. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Converts Python abstract syntax trees (ASTs) back into readable Python source code, allowing you to reconstruct or inspect code from its parsed AST representation. Yes. The package is lightweight (no dependencies), actively maintained with recent commits, supports current Python versions, and has no known vulnerabilities. Install it if you need to convert ASTs back to source code for inspection, debugging, or code generation workflows. ## Install pip install ast-decompiler uv add ast-decompiler poetry add ast-decompiler ## Installing ast-decompiler Before you install: Low friction install with no runtime dependencies. The package is actively maintained with recent commits and supports current Python versions (3.8–3.13), making it reliable for modern projects. License in practice: Licensed under the Python Software Foundation License, a permissive license that allows broad use with minimal restrictions. Quickstart: import ast from ast_decompiler import decompile code = decompile(ast.parse('(a + b) * c')) print(code) # Output: (a + b) * c Verify before relying: - Completeness of AST-to-code coverage: whether all Python constructs are supported or if some edge cases remain unhandled. - Performance characteristics on large or deeply nested ASTs. ## Package facts - License: not declared (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 176.0K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags ast to code generation, decompile python ast, reconstruct source from ast, ast code generation, python ast decompiler, generate code from ast, ast to source code, ast-manipulation, code-generation [View on SkillFed](https://skillfed.io/packages/ast-decompiler) · [View on PyPI](https://pypi.org/project/ast-decompiler/)