Skip to content

PyCraftTool/PyCraft

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PyCraft

PyCraft is a tool that refactors python code

Tool Pipeline

Schematic Diagram

  1. To extract CPATs, we use R-CPATMiner
  2. The code in this repository leverages LLMs to generate variants
  3. To Synthesise and apply tranformation rules, we utilise PyEvolve

Requirements

  1. Python 3+
  2. API key to your preferred LLM

Installation

  1. Install dependencies

    pip install -r requirements.txt

Usage

Configure PyCraft

  1. Configure the LLM that you would like to use:

    python pycraft configure llm \
          --name gpt-3.5-turbo \
          --key <your-api-key-here>
    
  2. 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)"
    

Generating Variants

Run the fetch-variants command

python pycraft fetch-variants

About

PyCraft is a tool that refactors python code

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages