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]
Minor condition changes
John Yang233533a94ee5
diff --git a/sweagent/environment/swe_env.py b/sweagent/environment/swe_env.pyindex 7929aef0..b4a3594d 100644--- a/sweagent/environment/swe_env.py+++ b/sweagent/environment/swe_env.py@@ -714,7 +714,7 @@ class SWEEnv(gym.Env):self.record, env_name, python_version=install_configs["python"])copy_file_to_container(self.container_obj, content_env_yml, PATH_TO_ENV_YML)- if "no_use_env" in install_configs and install_configs["no_use_env"]:+ if install_configs.get("no_use_env", False):# Create conda environmentself.communicate_with_handling(f"conda create -c conda-forge -n {env_name} python={install_configs['python']} -y",@@ -743,7 +743,7 @@ class SWEEnv(gym.Env):timeout_duration=LONG_TIMEOUT,)# Install extra pip packages if specified- if "pip_packages" in install_configs:+ if install_configs.get("pip_packages", False):self.communicate_with_handling(f"source activate {env_name} && pip install {' '.join(install_configs['pip_packages'])}",error_msg="Failed to install pip packages",@@ -757,7 +757,7 @@ class SWEEnv(gym.Env):)# Install repo at base commit- if "pre_install" in install_configs:+ if install_configs.get("pre_install", False):self.logger.info("Running pre-install commands...")for pre_install_cmd in install_configs["pre_install"]:self.communicate_with_handling(@@ -765,14 +765,14 @@ class SWEEnv(gym.Env):error_msg="Pre-install commands failed to execute successfully",)self.logger.info(f"Installing {self._repo_name} at base commit...")- if "install" in install_configs:+ if install_configs.get("install", False):install_cmd = install_configs["install"]self.communicate_with_handling(install_cmd,error_msg="Install command failed to execute successfully",timeout_duration=LONG_TIMEOUT)- if "post_install" in install_configs:+ if install_configs.get("post_install", False):self.logger.info("Running post-install commands...")for post_install_cmd in install_configs["post_install"]:self.communicate_with_handling(