Skip to content

Commit 585c526

Browse files
committed
fix python sdk bugs
1 parent 26636d7 commit 585c526

File tree

1 file changed

+3
-17
lines changed

1 file changed

+3
-17
lines changed

baselines/run_aider.py

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,11 @@
1717
from tqdm import tqdm
1818
from concurrent.futures import ThreadPoolExecutor, as_completed
1919
from commit0.harness.constants import RUN_AIDER_LOG_DIR
20-
from commit0.harness.docker_build import setup_logger
2120

2221
from aider.coders import Coder
2322
from aider.models import Model
23+
from aider.io import InputOutput
24+
2425

2526
class DirContext:
2627
def __init__(self, d):
@@ -57,7 +58,7 @@ def run_aider(
5758
input_history_file = log_dir / ".aider.input.history"
5859
chat_history_file = log_dir / ".aider.chat.history.md"
5960
io = InputOutput(yes=True, input_history_file=input_history_file, chat_history_file=chat_history_file)
60-
coder = Coder.create(main_model=model, fnames=fnames, auto_lint=auto_lint, lint_cmds=[lint_cmd], io=io)
61+
coder = Coder.create(main_model=model, fnames=fnames, auto_lint=auto_lint, lint_cmds=lint_cmd, io=io)
6162
coder.run(message)
6263

6364

@@ -75,7 +76,6 @@ def run_aider_for_repo(
7576

7677
# Call the commit0 get-tests command to retrieve test files
7778
test_files_str = get_tests(repo_name, stdout=False)
78-
7979
test_files = sorted(list(set([i.split(":")[0] for i in test_files_str])))
8080

8181
repo_path = os.path.join(commit0_config.base_dir, repo_name)
@@ -96,10 +96,6 @@ def run_aider_for_repo(
9696
else:
9797
lint_cmd = ""
9898

99-
print(
100-
f"Aider logs for {repo_name} can be found in: {Path.cwd() /RUN_AIDER_LOG_DIR}"
101-
)
102-
10399
if aider_config.run_tests:
104100
for test_file in test_files:
105101
test_cmd = f"python -m commit0 test {repo_path} {test_file}"
@@ -108,7 +104,6 @@ def run_aider_for_repo(
108104
log_dir = RUN_AIDER_LOG_DIR / "with_tests" / test_file_name
109105
log_dir.mkdir(parents=True, exist_ok=True)
110106
log_file = log_dir / "run_aider.log"
111-
logger = setup_logger(repo_name, log_file)
112107

113108
aider_cmd = run_aider(
114109
aider_config.llm_name,
@@ -126,17 +121,13 @@ def run_aider_for_repo(
126121
# write test command to log file
127122
test_cmd_file = Path(log_dir / "test_cmd.sh")
128123
test_cmd_file.write_text(test_cmd)
129-
130-
execute_aider_cmd(aider_cmd, logger)
131124
else:
132125
test_cmd = ""
133126
for f in target_edit_files:
134-
# set up logging
135127
file_name = f.replace(".py", "").replace("/", "__")
136128
log_dir = RUN_AIDER_LOG_DIR / "no_tests" / file_name
137129
log_dir.mkdir(parents=True, exist_ok=True)
138130
log_file = log_dir / "run_aider.log"
139-
logger = setup_logger(repo_name, log_file)
140131

141132
aider_cmd = run_aider(
142133
aider_config.llm_name,
@@ -146,11 +137,6 @@ def run_aider_for_repo(
146137
lint_cmd,
147138
log_dir,
148139
)
149-
# write aider command to log file
150-
aider_cmd_file = Path(log_dir / "aider_cmd.sh")
151-
aider_cmd_file.write_text(aider_cmd)
152-
153-
execute_aider_cmd(aider_cmd, logger)
154140

155141

156142
def main() -> None:

0 commit comments

Comments
 (0)