bumblebee
bumblebee copied to clipboard
An IntelliJ-based IDE plugin for Python AST transformations
Bumblebee
An IntelliJ-based IDE plugin for performing Python AST transformations using PSI elements. You can use this plugin as a library or as a tool to work with Python PSI. The differences between these options can be found below.
Available transformations
- [x] Anonymization
- [x] Augmented Assignment
- [x] Comments Removal
- [x] Comparison Unification
- [x] Constant folding
- [x] Dead Code Removal
- [x] EmptyLinesRemoval
- [x] Expression Unification
- [x] If Statement Redundant Lines Removal
- [x] Multiple Operator Comparison
- [x] Multiple Target Assignment
- [x] Outer Not Elimination
Installation
Just clone the repo by git clone https://github.com/JetBrains-Research/ast-transformations
.
Getting started as a tool
Run the command ./gradlew :ast-transformations-plugin:cli -Pinput=<Input directory with python files> -Poutput=<Output directory>
.
All transformations will be applied.
Getting started as a library
You can use this plugin as a library in your plugin by importing it in settings.gradle.kts
and build.gradle.kts files
:
- File
settings.gradle.kts
:
sourceControl {
gitRepository(URI.create("https://github.com/JetBrains-Research/ast-transformations.git")) {
producesModule("org.jetbrains.research.ml.ast.transformations:ast-transformations")
}
}
- File
build.gradle.kts
:
implementation("org.jetbrains.research.ml.ast.transformations:ast-transformations") {
version {
branch = "master"
}
}
The available features:
- Forward transformations
- Backward transformations (unstable)
All usage examples can be found in the test folder.