From b3cb17d87dde693ad23c5ae95bae13cfca408e6b Mon Sep 17 00:00:00 2001 From: Mike Gehard Date: Sun, 24 Nov 2024 15:32:59 -0500 Subject: [PATCH 1/4] Fix dependencies for Python3 version 3.13 I tried to follow the installation instructions but kept getting errors. I updated the dependencies to get things working. I updated duckdb to just 1.0.0 because I figured that it would be safer to do the minimal update possible to get things working. I was able to get a successful solution after these upgrades using: python -m alpha_codium.solve_problem \ --dataset_name /Users/mikegehard/workspace/aiAssistedAgile/AlphaCodium/valid_and_test_processed \ --split_name test \ --problem_number 0 --- README.md | 5 +++++ requirements.txt | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 2abc1b3..1153837 100644 --- a/README.md +++ b/README.md @@ -50,6 +50,11 @@ Many of the principles and best practices we acquired in this work, we believe, ## Installation +### Pre-requisites + +1. Python3 +2. Rust compiler + (1) setup a virtual environment: ```bash python3 -m venv venv diff --git a/requirements.txt b/requirements.txt index 1c324d1..b9cf7cf 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,9 +1,9 @@ dynaconf==3.1.12 -fastapi==0.99.0 +fastapi==0.115.5 PyGithub==1.59.* retry==0.9.2 Jinja2==3.1.2 -tiktoken==0.5.2 +tiktoken==0.8.0 uvicorn==0.22.0 pytest==7.4.0 aiohttp==3.9.3 @@ -19,7 +19,7 @@ msrest==0.7.1 ## openai litellm -duckdb==0.9.2 +duckdb==1.0.0 datasets notebook black From d785b76ad4337b093d447962f75d6d1ef80c8a7b Mon Sep 17 00:00:00 2001 From: Mike Gehard Date: Sun, 24 Nov 2024 15:38:04 -0500 Subject: [PATCH 2/4] Update as per PR code suggestions --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index b9cf7cf..91dd8f6 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,7 +4,7 @@ PyGithub==1.59.* retry==0.9.2 Jinja2==3.1.2 tiktoken==0.8.0 -uvicorn==0.22.0 +uvicorn==0.24.0 pytest==7.4.0 aiohttp==3.9.3 atlassian-python-api==3.39.0 From 82906c4e8cc216efc0ca70cafcb73092a02156d9 Mon Sep 17 00:00:00 2001 From: Mike Gehard Date: Mon, 25 Nov 2024 17:36:23 -0500 Subject: [PATCH 3/4] Allow the CLI user to set the logging level. This makes it easier for someone learning the code to see what is happening in the bowels of the codebase. --- alpha_codium/solve_dataset.py | 5 ++++- alpha_codium/solve_my_problem.py | 5 ++++- alpha_codium/solve_problem.py | 4 +++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/alpha_codium/solve_dataset.py b/alpha_codium/solve_dataset.py index 63ebb98..ccd39f2 100644 --- a/alpha_codium/solve_dataset.py +++ b/alpha_codium/solve_dataset.py @@ -9,9 +9,12 @@ parser.add_argument("--dataset_name", type=str, default="valid_and_test_processed") parser.add_argument("--split_name", type=str, default="valid") parser.add_argument("--database_solution_path", type=str, default="") +parser.add_argument('--log-level', type=str, default='INFO', + choices=['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL']) + if __name__ == "__main__": args = parser.parse_args() - setup_logger() + setup_logger(level=args.log_level) # set default database_solution_path args.database_solution_path = args.database_solution_path diff --git a/alpha_codium/solve_my_problem.py b/alpha_codium/solve_my_problem.py index 6dd5868..3da11f5 100644 --- a/alpha_codium/solve_my_problem.py +++ b/alpha_codium/solve_my_problem.py @@ -7,10 +7,13 @@ parser = argparse.ArgumentParser() parser.add_argument("--my_problem_json_file", type=str, default="my_problem_example.json") +parser.add_argument('--log-level', type=str, default='INFO', + choices=['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL']) + if __name__ == "__main__": args = parser.parse_args() - setup_logger() + setup_logger(level=args.log_level) with open(args.my_problem_json_file, "r") as my_problem: solve_my_problem(json.load(my_problem)) diff --git a/alpha_codium/solve_problem.py b/alpha_codium/solve_problem.py index 579e13f..0e01940 100644 --- a/alpha_codium/solve_problem.py +++ b/alpha_codium/solve_problem.py @@ -9,10 +9,12 @@ parser.add_argument("--split_name", type=str, default="valid") parser.add_argument("--problem_number", type=int, default=0) parser.add_argument("--problem_name", type=str, default="") +parser.add_argument('--log-level', type=str, default='INFO', + choices=['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL']) if __name__ == "__main__": args = parser.parse_args() - setup_logger() + setup_logger(level=args.log_level) solve_problem(dataset_name=args.dataset_name, split_name=args.split_name, problem_number=args.problem_number, From 4658c7ef32a4b3195a01fdcc0574d2ad109e3795 Mon Sep 17 00:00:00 2001 From: Mike Gehard Date: Mon, 25 Nov 2024 17:47:29 -0500 Subject: [PATCH 4/4] Cleanup as suggested by PR bot --- alpha_codium/constants.py | 3 +++ alpha_codium/solve_dataset.py | 3 ++- alpha_codium/solve_my_problem.py | 3 ++- alpha_codium/solve_problem.py | 3 ++- 4 files changed, 9 insertions(+), 3 deletions(-) create mode 100644 alpha_codium/constants.py diff --git a/alpha_codium/constants.py b/alpha_codium/constants.py new file mode 100644 index 0000000..c70384b --- /dev/null +++ b/alpha_codium/constants.py @@ -0,0 +1,3 @@ +"""Common constants used across the codebase.""" + +LOG_LEVEL_CHOICES = ['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL'] diff --git a/alpha_codium/solve_dataset.py b/alpha_codium/solve_dataset.py index ccd39f2..1807d74 100644 --- a/alpha_codium/solve_dataset.py +++ b/alpha_codium/solve_dataset.py @@ -2,6 +2,7 @@ from alpha_codium.gen.dataset_solver import solve_dataset from alpha_codium.log import get_logger, setup_logger +from alpha_codium.constants import LOG_LEVEL_CHOICES logger = get_logger(__name__) @@ -10,7 +11,7 @@ parser.add_argument("--split_name", type=str, default="valid") parser.add_argument("--database_solution_path", type=str, default="") parser.add_argument('--log-level', type=str, default='INFO', - choices=['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL']) + choices=LOG_LEVEL_CHOICES) if __name__ == "__main__": args = parser.parse_args() diff --git a/alpha_codium/solve_my_problem.py b/alpha_codium/solve_my_problem.py index 3da11f5..9f61bdb 100644 --- a/alpha_codium/solve_my_problem.py +++ b/alpha_codium/solve_my_problem.py @@ -3,12 +3,13 @@ from alpha_codium.gen.coding_competitor import solve_problem, solve_my_problem from alpha_codium.log import setup_logger +from alpha_codium.constants import LOG_LEVEL_CHOICES from alpha_codium.settings.config_loader import get_settings parser = argparse.ArgumentParser() parser.add_argument("--my_problem_json_file", type=str, default="my_problem_example.json") parser.add_argument('--log-level', type=str, default='INFO', - choices=['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL']) + choices=LOG_LEVEL_CHOICES) if __name__ == "__main__": diff --git a/alpha_codium/solve_problem.py b/alpha_codium/solve_problem.py index 0e01940..18cb394 100644 --- a/alpha_codium/solve_problem.py +++ b/alpha_codium/solve_problem.py @@ -2,6 +2,7 @@ from alpha_codium.gen.coding_competitor import solve_problem from alpha_codium.log import setup_logger +from alpha_codium.constants import LOG_LEVEL_CHOICES from alpha_codium.settings.config_loader import get_settings parser = argparse.ArgumentParser() @@ -10,7 +11,7 @@ parser.add_argument("--problem_number", type=int, default=0) parser.add_argument("--problem_name", type=str, default="") parser.add_argument('--log-level', type=str, default='INFO', - choices=['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL']) + choices=LOG_LEVEL_CHOICES) if __name__ == "__main__": args = parser.parse_args()