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]
Fix: Import "Self" compatible with < py3.11
Kilian Lieret2b31a45a3dc6
diff --git a/sweagent/agent/agents.py b/sweagent/agent/agents.pyindex 3a7d1fb7..8e69fa84 100644--- a/sweagent/agent/agents.py+++ b/sweagent/agent/agents.py@@ -5,12 +5,13 @@ import jsonimport timefrom collections import defaultdictfrom pathlib import Path-from typing import Any, Self+from typing import Anyfrom pydantic import BaseModel, ConfigDict, Fieldfrom simple_parsing.helpers.fields import fieldfrom swerex.exceptions import BashIncorrectSyntaxError, SweRexceptionfrom tenacity import RetryError+from typing_extensions import Selffrom sweagent import __version__, get_agent_commit_hashfrom sweagent.agent.history_processors import DefaultHistoryProcessor, HistoryProcessordiff --git a/sweagent/agent/hooks/status.py b/sweagent/agent/hooks/status.pyindex f7781935..340d9ac2 100644--- a/sweagent/agent/hooks/status.py+++ b/sweagent/agent/hooks/status.py@@ -16,7 +16,7 @@ class SetStatusAgentHook(AbstractAgentHook):def on_step_start(self):self._i_step += 1- self._update(f"Step {self._i_step} ({self._cost:.2f}$)")+ self._update(f"Step {self._i_step} (${self._cost:.2f})")def on_step_done(self, *, step: StepOutput, info: AgentInfo):self._cost = info.get("cost", 0.0)diff --git a/sweagent/environment/config/repo.py b/sweagent/environment/config/repo.pyindex a1e6a6eb..7a1779b3 100644--- a/sweagent/environment/config/repo.py+++ b/sweagent/environment/config/repo.py@@ -1,7 +1,7 @@import asyncioimport osfrom pathlib import Path-from typing import Literal, Protocol, Self+from typing import Literal, Protocolimport pydanticfrom git import InvalidGitRepositoryError@@ -9,6 +9,7 @@ from git import Repo as GitRepofrom pydantic import BaseModelfrom swerex.deployment.abstract import AbstractDeploymentfrom swerex.runtime.abstract import Command, UploadRequest+from typing_extensions import Selffrom sweagent.utils.log import get_loggerdiff --git a/sweagent/run/batch_instances.py b/sweagent/run/batch_instances.pyindex 5752c934..90a31004 100644--- a/sweagent/run/batch_instances.py+++ b/sweagent/run/batch_instances.py@@ -2,7 +2,7 @@ import jsonimport refrom abc import ABC, abstractmethodfrom pathlib import Path-from typing import Any, Literal, Self+from typing import Any, Literalimport yamlfrom pydantic import BaseModel, Field@@ -12,6 +12,7 @@ from swerex.deployment.config import (DummyDeploymentConfig,LocalDeploymentConfig,)+from typing_extensions import Selffrom sweagent.environment.config.problem_statement import ProblemStatementConfig, TextProblemStatementfrom sweagent.environment.config.repo import PreExistingRepodiff --git a/sweagent/run/run_replay.py b/sweagent/run/run_replay.pyindex eba0d574..82f32eaf 100644--- a/sweagent/run/run_replay.py+++ b/sweagent/run/run_replay.py@@ -5,13 +5,14 @@ import sysimport tempfilefrom getpass import getpassfrom pathlib import Path-from typing import Any, Self+from typing import Anyimport yamlfrom pydantic import Fieldfrom pydantic_settings import BaseSettingsfrom swerex.deployment.abstract import AbstractDeploymentfrom swerex.deployment.config import DeploymentConfig, DockerDeploymentConfig, get_deployment+from typing_extensions import Selffrom sweagent import CONFIG_DIRfrom sweagent.agent.agents import Agent, AgentConfigdiff --git a/sweagent/tools/tools.py b/sweagent/tools/tools.pyindex 29e3606a..fe940912 100644--- a/sweagent/tools/tools.py+++ b/sweagent/tools/tools.py@@ -3,12 +3,13 @@ import jsonimport refrom functools import cached_propertyfrom pathlib import Path-from typing import Any, Self+from typing import Anyimport yamlfrom pydantic import BaseModel, Fieldfrom swerex.runtime.abstract import Command as RexCommandfrom swerex.runtime.abstract import UploadRequest+from typing_extensions import Selffrom sweagent.environment.swe_env import SWEEnvfrom sweagent.tools.commands import Command, ParseCommand, ParseCommandBash