Skip to main content

AST Transforms

A collection of AST-based Python transformations for manipulating code programmatically.

Installation

pip install ast_transforms

Usage

import ast
import ast_transforms as at

code = '''
@mydecorator
def foo():
    print("foo")
'''

# Parse code into an AST
tree = ast.parse(code)

# Apply transformations
tree = at.remove_func_decorator(tree)  # removes all function decorators

# Convert AST back to source code
new_code = ast.unparse(tree)
print(new_code)

Output:

def foo():
    print("foo")

Passes

  • remove_func_decorator(tree) – removes all decorators from functions.
  • More passes are to be added ...

Metadata

Release files for ast-transforms 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ast-transforms 0.2.0
File Size Uploaded
ast_transforms-0.2.0.tar.gz 7.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ast-transforms 0.2.0
File Interpreter ABI Platform
ast_transforms-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 18.0 kB

Release files / ast_transforms-0.2.0.tar.gz

Download URL ast_transforms-0.2.0.tar.gz
Size 7.9 kB
Tags Source
SHA-256 checksum
How to use checksums
9fb3f1147ab319dc30e6991925e91460bcbbefad9f83775851b20ad0291f88a4
BLAKE2b-256 checksum
How to use checksums
462512d221cc946abab8e185d99ed929ad024a9d4a5d9eda21decf9453a25ec8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Release files / ast_transforms-0.2.0-py3-none-any.whl

Download URL ast_transforms-0.2.0-py3-none-any.whl
Size 10.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
81071e93f0675ffce77d2111ce774819b0fbf8c75a95c565881e978b63f413eb
BLAKE2b-256 checksum
How to use checksums
dade3a63d3243a599944e806e27e52b42f4f053c3ea9b503e6bb65777f249161
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.13

2 release files

0.1.12

2 release files

0.1.11

2 release files

0.1.10

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page