PyCraft is a tool that refactors python code
- To extract CPATs, we use R-CPATMiner
- The code in this repository leverages LLMs to generate variants
- To Synthesise and apply tranformation rules, we utilise PyEvolve
- Python 3+
- API key to your preferred LLM
-
Install dependencies
pip install -r requirements.txt
-
Configure the LLM that you would like to use:
python pycraft configure llm \ --name gpt-3.5-turbo \ --key <your-api-key-here>
-
Configure the CPAT(LHS, RHS) to generate variants for
python pycraft configure cpat \ --name numpy-sum \ --lhs "count = 0 for i in int_list: count +=i" \ --rhs "import numpy as np count = np.sum(int_list)"
Run the fetch-variants command
python pycraft fetch-variants