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]
Add usage doc to run.py (#243)
Kilian Lieret1bad3e33a022
diff --git a/environment.yml b/environment.ymlindex 19a5c8a4..e35b8058 100644--- a/environment.yml+++ b/environment.yml@@ -19,3 +19,4 @@ dependencies:- simple-parsing- together- ollama+ - rich-argparsediff --git a/run.py b/run.pyindex bc93288a..0a9e873f 100644--- a/run.py+++ b/run.py@@ -9,8 +9,15 @@ import rich.consoleimport rich.markdownimport rich.panelimport rich.markdown+try:+ from rich_argparse import RichHelpFormatter+except ImportError:+ msg = (+ "Please install the rich_argparse package with `pip install rich_argparse`."+ )+ raise ImportError(msg)import yaml-+from rich.markdown import Markdownfrom dataclasses import dataclassfrom getpass import getuserfrom pathlib import Path@@ -31,6 +38,16 @@ from unidiff import PatchSetfrom sweagent.environment.utils import InvalidGithubURL, get_associated_commit_urls, get_gh_issue_data, parse_gh_issue_url+__doc__: str = """ Run inference. Usage examples:++```bash+# Run over a github issue:+python run.py --model_name "gpt4" --data_path "https://github.com/pvlib/pvlib-python/issues/1603" --config_file "config/default_from_url.yaml"+# Apply a patch in a local repository to an issue specified as Markdown file and run a custom installer script in the container+python run.py --model_name "gpt4" --data_path "/path/to/my_issue.md" --repo_path "/path/to/my/local/repo" --environment_setup "/path/to/setup.sh" --config_file "config/default_from_url.yaml" --apply_patch_locally+```+"""+handler = RichHandler(show_time=False, show_path=False)handler.setLevel(logging.DEBUG)logger = logging.getLogger("run_dev")@@ -363,7 +380,7 @@ def get_args(args=None) -> ScriptArguments:yaml.add_representer(str, multiline_representer)- return parse(ScriptArguments, default=defaults, add_config_path_arg=False, args=args)+ return parse(ScriptArguments, default=defaults, add_config_path_arg=False, args=args, formatter_class=RichHelpFormatter, description=Markdown(__doc__))if __name__ == "__main__":diff --git a/setup.py b/setup.pyindex af00bc3f..067f2e8f 100644--- a/setup.py+++ b/setup.py@@ -43,6 +43,7 @@ setuptools.setup('tenacity','together','unidiff',+ 'rich-argparse',],include_package_data=True,)