Skip to content

TOProgramming/onion

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Onion

Onion is a proof-of-concept tool that implements TOP (Test-Oriented Programming) for Python. It has been tested with the following LLMs: OpenAI's GPT-4o-mini and Gemini 2.5-Flash but in principle it should work with others.

Execution

At this stage, there is no pre-built package. To run the tool, first you need to install the requirements (ideally in a virtual environment):

pip install -r requirements.txt

You will also need .env file in the main folder with the API keys to connect to the LLMs.

OPENAI_API_KEY=<your key to access OpenAI's models>
GOOGLE_API_KEY=<your key to access Gemini models>

To invoke the tool, use the following command:

python -m onion <action> <project_folder> [options]

The actions can be: generate, check, report, coverage, clean, revert. The project folder must contain a main.yml file with the description of the project and the acceptance tests (among other things) in natural language but organized following a YAML format. Please check the examples/bib-cli/main.yml for an example.

Examples

Here are some examples of invoking the tool.

To generate the code for the project in the folder examples/bib-cli, use:

python -m onion generate examples/bib-cli

To remove only the production code generated (keeping the structure file and the tests), use:

python -m onion clean examples/bib-cli

To also remove the tests but keep the structure file:

python -m onion clean examples/bib-cli --remove-tests

To also remove all the generated files, including the structure file:

python -m onion clean examples/bib-cli --remove-all

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages