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]
Enh: Call sweagent with python -m (#860)
Kilian Liereta17a3e9bad5a
diff --git a/docs/dev/contribute.md b/docs/dev/contribute.mdindex 50cb28d8..764e4e8f 100644--- a/docs/dev/contribute.md+++ b/docs/dev/contribute.md@@ -79,6 +79,23 @@ If you are using VSCode, you might want to add the following two files:```</details>+## Debugging++We recommend to install `pdbpp` for some improved debugger features:++```bash+pip install pdbpp+```++Set breakpoints with `breakpoint()` and then run `sweagent` with `pdb`:++```bash+pdb -m sweagent <command> -- <more command line arguments> # (1)!+```++1. Note the `--` before the options passed to sweagent. This is to separate+ options passed to `pdb` from those that are passed to `sweagent`.+## Tips for pull requests* If you see a lot of formatting-related merge conflicts, please see [here](formatting_conflicts.md).diff --git a/docs/installation/source.md b/docs/installation/source.mdindex f3f50bcf..1df28ba2 100644--- a/docs/installation/source.md+++ b/docs/installation/source.md@@ -13,7 +13,23 @@ Installation from source is the preferred way to set up SWE-agent on your machinat the repository root (as with any python setup, it's recommended to use [conda][] or [virtual environments][] to manage dependencies).3. Set up your language model of choice as explained [here](keys.md).-**Optional:**+Let's run a quick check:++```bash+sweagent --help+```++should show an overview over the available top-level commands.++<details>+<summary>Command not found?</summary>++You might also try `python -m sweagent`. If this also doesn't work,+please check with `which python` that you're using the same `python` as+when you installed SWE-agent.+</details>++**Optional installation steps:**1. The default backend for SWE-agent is docker, so we recommend to install Docker([follow the docs](https://github.com/docker/docker-install) or use the [get-docker.sh script for linux](https://github.com/docker/docker-install)),diff --git a/sweagent/__main__.py b/sweagent/__main__.pynew file mode 100644index 00000000..57dedfa1--- /dev/null+++ b/sweagent/__main__.py@@ -0,0 +1,4 @@+from sweagent.run.run import main++if __name__ == "__main__":+ main()diff --git a/sweagent/run/run.py b/sweagent/run/run.pyindex 9cb7d173..da2b34b6 100644--- a/sweagent/run/run.py+++ b/sweagent/run/run.py@@ -113,4 +113,4 @@ def main(args: list[str] | None = None):if __name__ == "__main__":- main()+ sys.exit(main())