SWE-agent takes a GitHub issue and tries to automatically fix it, using your LM of choice. It can also be employed for offensive cybersecurity or competitive coding challenges. [NeurIPS 2024]
Ensure flake8 is available in env
Kilian Lieretf23b8ea516d3
diff --git a/config/commands/_split_string.py b/config/commands/_split_string.pyindex c6c00c07..b4a4a780 100644--- a/config/commands/_split_string.py+++ b/config/commands/_split_string.py@@ -32,8 +32,12 @@ class Flake8Error:@classmethoddef from_line(cls, line: str):- prefix, _sep, problem = line.partition(": ")- filename, line_number, col_number = prefix.split(":")+ try:+ prefix, _sep, problem = line.partition(": ")+ filename, line_number, col_number = prefix.split(":")+ except (ValueError, IndexError) as e:+ msg = f"Invalid flake8 error line: {line}"+ raise ValueError(msg) from ereturn cls(filename, int(line_number), int(col_number), problem)diff --git a/sweagent/tools/tools.py b/sweagent/tools/tools.pyindex 23e9b09d..d3ab854f 100644--- a/sweagent/tools/tools.py+++ b/sweagent/tools/tools.py@@ -75,6 +75,7 @@ class ToolConfig(BaseModel):"mkdir -p /root/commands","touch /root/commands/__init__.py","export PATH=$PATH:/root/commands",+ "flake8 --version || pip install flake8",]"""Commands to install dependencies and tools.These commands are executed in a subprocess and are not part of the environment state.