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]
Change: Rename PreExistingRepoConfig for consistency
Kilian Lieretd675dd74b633
diff --git a/docs/reference/repo.md b/docs/reference/repo.mdindex a6572088..7648962d 100644--- a/docs/reference/repo.md+++ b/docs/reference/repo.md@@ -2,7 +2,7 @@We currently support the following repository types:-* A pre-existing repository (`PreExistingRepo`)+* A pre-existing repository (`PreExistingRepoConfig`)* A local repository (`LocalRepoConfig`)* A GitHub repository (`GithubRepoConfig`)@@ -23,7 +23,7 @@ For example:All of these classes are defined in `sweagent.environment.config.repo`.-::: sweagent.environment.config.repo.PreExistingRepo+::: sweagent.environment.config.repo.PreExistingRepoConfigoptions:show_root_full_path: falseshow_bases: falsediff --git a/docs/usage/cl_tutorial.md b/docs/usage/cl_tutorial.mdindex e05f26ca..40d97186 100644--- a/docs/usage/cl_tutorial.md+++ b/docs/usage/cl_tutorial.md@@ -184,7 +184,7 @@ Again, those are [union types](union-types). See here for all the options:* [`GithubRepoConfig`](../reference/repo.md#sweagent.environment.config.repo.GithubRepoConfig): Pull a repository from GitHub.* [`LocalRepoConfig`](../reference/repo.md#sweagent.environment.config.repo.LocalRepoConfig): Copies a repository from your local filesystem to the docker container.-* [`PreExistingRepo`](../reference/repo.md#sweagent.environment.config.repo.PreExistingRepo): If you want to use a repository that already exists on the docker container.+* [`PreExistingRepoConfig`](../reference/repo.md#sweagent.environment.config.repo.PreExistingRepoConfig): If you want to use a repository that already exists on the docker container.## Taking actionsdiff --git a/sweagent/environment/config/repo.py b/sweagent/environment/config/repo.pyindex ee83d74c..52a1247d 100644--- a/sweagent/environment/config/repo.py+++ b/sweagent/environment/config/repo.py@@ -26,7 +26,7 @@ class Repo(Protocol):def copy(self, deployment: AbstractDeployment): ...-class PreExistingRepo(BaseModel):+class PreExistingRepoConfig(BaseModel):"""Use this to specify a repository that already exists on the deployment.This is important because we need to cd to the repo before running the agent.@@ -151,7 +151,7 @@ class GithubRepoConfig(BaseModel):)-RepoConfig = LocalRepoConfig | GithubRepoConfig | PreExistingRepo+RepoConfig = LocalRepoConfig | GithubRepoConfig | PreExistingRepoConfigdef repo_from_simplified_input(@@ -169,7 +169,7 @@ def repo_from_simplified_input(if type == "github":return GithubRepoConfig(github_url=input, base_commit=base_commit)if type == "preexisting":- return PreExistingRepo(repo_name=input, base_commit=base_commit)+ return PreExistingRepoConfig(repo_name=input, base_commit=base_commit)if type == "auto":if input.startswith("https://github.com/"):return GithubRepoConfig(github_url=input, base_commit=base_commit)diff --git a/sweagent/run/batch_instances.py b/sweagent/run/batch_instances.pyindex c710a563..484a346f 100644--- a/sweagent/run/batch_instances.py+++ b/sweagent/run/batch_instances.py@@ -16,7 +16,7 @@ from swerex.deployment.config import (from typing_extensions import Selffrom sweagent.environment.config.problem_statement import ProblemStatementConfig, TextProblemStatement-from sweagent.environment.config.repo import GithubRepoConfig, LocalRepoConfig, PreExistingRepo+from sweagent.environment.config.repo import GithubRepoConfig, LocalRepoConfig, PreExistingRepoConfigfrom sweagent.environment.swe_env import EnvironmentConfigfrom sweagent.utils.log import get_logger@@ -134,7 +134,7 @@ class SimpleBatchInstance(BaseModel):elif "github" in self.repo_name:repo = GithubRepoConfig(github_url=self.repo_name, base_commit=self.base_commit)elif "/" not in self.repo_name:- repo = PreExistingRepo(repo_name=self.repo_name, base_commit=self.base_commit)+ repo = PreExistingRepoConfig(repo_name=self.repo_name, base_commit=self.base_commit)else:repo = LocalRepoConfig(path=Path(self.repo_name), base_commit=self.base_commit)if isinstance(deployment, LocalDeploymentConfig):diff --git a/tests/test_batch_instance.py b/tests/test_batch_instance.pyindex e0a283b2..b351f3bd 100644--- a/tests/test_batch_instance.py+++ b/tests/test_batch_instance.py@@ -4,7 +4,7 @@ import pytestfrom swerex.deployment.config import DockerDeploymentConfigfrom sweagent.environment.config.problem_statement import TextProblemStatement-from sweagent.environment.config.repo import PreExistingRepo+from sweagent.environment.config.repo import PreExistingRepoConfigfrom sweagent.run.batch_instances import BatchInstance, SimpleBatchInstance, SWEBenchInstances, _slice_spec_to_slice@@ -13,7 +13,7 @@ def test_simple_batch_from_swe_bench_to_full_batch_instance(test_data_sources_painstance = SimpleBatchInstance.from_swe_bench(sb_instance).to_full_batch_instance(DockerDeploymentConfig(image="python:3.11"))- assert isinstance(instance.env.repo, PreExistingRepo)+ assert isinstance(instance.env.repo, PreExistingRepoConfig)assert instance.env.repo.repo_name == "testbed"assert isinstance(instance.env.deployment, DockerDeploymentConfig)assert instance.env.deployment.image == "swebench/sweb.eval.x86_64.pydicom_1776_pydicom-1458:latest"