From fc9013490999360b4a36cabac66f405acd411816 Mon Sep 17 00:00:00 2001 From: MarcCote <660004+MarcCote@users.noreply.github.com> Date: Wed, 18 Nov 2026 15:56:29 +0000 Subject: [PATCH 1/5] Initial plan From 760367736e89dcf0e22630c3dcc2c5e74e5155a1 Mon Sep 17 00:00:00 2001 From: MarcCote <660004+MarcCote@users.noreply.github.com> Date: Wed, 18 Nov 2026 15:58:38 +0000 Subject: [PATCH 2/5] Constrain only sglang in PyPI test install Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> --- .github/actions/test-if-changes/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/test-if-changes/action.yml b/.github/actions/test-if-changes/action.yml index e031d2fa3..b629a4d5b 100644 --- a/.github/actions/test-if-changes/action.yml +++ b/.github/actions/test-if-changes/action.yml @@ -37,7 +37,7 @@ runs: if [[ -z "${{ inputs.version }}" ]]; then pip install -e '.[dev]' else - pip install "debug-gym[dev]==${{ inputs.version }}" + pip install -c requirements.txt "debug-gym[dev]==${{ inputs.version }}" fi df -h - name: Run tests From 18e314a76fe32be9ae18966ad518e1e99ffc0436 Mon Sep 17 00:00:00 2001 From: MarcCote <660004+MarcCote@users.noreply.github.com> Date: Wed, 18 Nov 2026 16:00:12 +0000 Subject: [PATCH 3/5] Constrain PyPI tests to pinned sglang Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> --- .github/actions/test-if-changes/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/test-if-changes/action.yml b/.github/actions/test-if-changes/action.yml index b629a4d5b..a5c395737 100644 --- a/.github/actions/test-if-changes/action.yml +++ b/.github/actions/test-if-changes/action.yml @@ -37,7 +37,7 @@ runs: if [[ -z "${{ inputs.version }}" ]]; then pip install -e '.[dev]' else - pip install -c requirements.txt "debug-gym[dev]==${{ inputs.version }}" + pip install -c <(grep '^sglang==' requirements.txt) "debug-gym[dev]==${{ inputs.version }}" fi df -h - name: Run tests From 15dff4ab028331b11785571df3d2c465b43cdad7 Mon Sep 17 00:00:00 2001 From: MarcCote <660004+MarcCote@users.noreply.github.com> Date: Wed, 18 Nov 2026 17:06:24 +0000 Subject: [PATCH 4/5] Remove default SGLang installation path Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> --- .github/actions/test-if-changes/action.yml | 8 +++++++- .github/workflows/tests_pypi.yml | 4 +++- README.md | 5 +++++ debug_gym/gym/envs/swe_smith.py | 22 ++++++++++++++++------ requirements-swesmith.txt | 15 +++++++++++++++ requirements.txt | 4 ---- 6 files changed, 46 insertions(+), 12 deletions(-) create mode 100644 requirements-swesmith.txt diff --git a/.github/actions/test-if-changes/action.yml b/.github/actions/test-if-changes/action.yml index a5c395737..931eeffb6 100644 --- a/.github/actions/test-if-changes/action.yml +++ b/.github/actions/test-if-changes/action.yml @@ -37,7 +37,13 @@ runs: if [[ -z "${{ inputs.version }}" ]]; then pip install -e '.[dev]' else - pip install -c <(grep '^sglang==' requirements.txt) "debug-gym[dev]==${{ inputs.version }}" + pip install -r requirements.txt + pip install pytest-asyncio pytest-cov pytest-xdist pytest-timeout pytest-env isort black Flask==3.1.3 Werkzeug==3.1.9 + pip install --no-deps "debug-gym==${{ inputs.version }}" + fi + if [[ "${{ inputs.name }}" == "swesmith" ]]; then + pip install -r requirements-swesmith.txt + pip install --no-deps swesmith==0.0.4 fi df -h - name: Run tests diff --git a/.github/workflows/tests_pypi.yml b/.github/workflows/tests_pypi.yml index 739ce4697..58fa3282f 100644 --- a/.github/workflows/tests_pypi.yml +++ b/.github/workflows/tests_pypi.yml @@ -151,7 +151,9 @@ jobs: - name: Install dependencies run: | pip install --upgrade pip - pip install "debug-gym[dev]==${{ needs.get-latest-release.outputs.release-tag }}" + pip install -r requirements.txt + pip install pytest-asyncio pytest-cov pytest-xdist pytest-timeout pytest-env isort black Flask==3.1.3 Werkzeug==3.1.9 + pip install --no-deps "debug-gym==${{ needs.get-latest-release.outputs.release-tag }}" - name: Test - PR - Fast env: DEBUG_GYM_DEBUG: 1 diff --git a/README.md b/README.md index c631db3e7..f4ba77a7a 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,11 @@ To install development dependencies, run: pip install -e '.[dev]' +SWE-Smith support is optional. From a repository checkout, install its dependencies and the package without its unused SGLang dependency: + + pip install -r requirements-swesmith.txt + pip install --no-deps swesmith==0.0.4 + **Set your API information in llm.yaml** diff --git a/debug_gym/gym/envs/swe_smith.py b/debug_gym/gym/envs/swe_smith.py index 3be5a9c92..3c0293e97 100644 --- a/debug_gym/gym/envs/swe_smith.py +++ b/debug_gym/gym/envs/swe_smith.py @@ -4,12 +4,6 @@ import docker import yaml from datasets import load_dataset, load_from_disk -from swesmith.build_repo.download_images import DOCKER_ORG, TAG -from swesmith.constants import MAP_REPO_TO_SPECS -from swesmith.harness.grading import TestStatus -from swesmith.harness.log_parsers import MAP_REPO_TO_PARSER, parse_log_pytest -from swesmith.harness.utils import get_test_command -from swesmith.utils import get_repo_commit_from_image_name from debug_gym.constants import DEBUG_GYM_CACHE_DIR from debug_gym.gym.entities import EvalOutput @@ -25,6 +19,18 @@ class SWESmithEnv(SWEBenchEnv): ) def setup_task(self): + try: + from swesmith.build_repo.download_images import DOCKER_ORG, TAG + from swesmith.constants import MAP_REPO_TO_SPECS + from swesmith.harness.log_parsers import MAP_REPO_TO_PARSER, parse_log_pytest + from swesmith.harness.utils import get_test_command + from swesmith.utils import get_repo_commit_from_image_name + except ImportError as exc: + raise ImportError( + "SWE-Smith support requires installing requirements-swesmith.txt " + "and swesmith==0.0.4 without dependencies." + ) from exc + self.base_commit = ( self.task_data["base_commit"] if "base_commit" in self.task_data else "main" ) @@ -138,6 +144,8 @@ def setup_terminal(self): raise RuntimeError(f"Failed to reset the git history:\n{output}") def calculate_score(self, eval_output: EvalOutput) -> int: + from swesmith.harness.grading import TestStatus + test_status_map = self.log_parser(eval_output.output) f2p_score = sum( 1 @@ -229,6 +237,8 @@ def load_dataset( ) if prepull_images: + from swesmith.build_repo.download_images import DOCKER_ORG, TAG + # Download all images needed for SWE-Smith. client = docker.from_env() tagged_image_names = set( diff --git a/requirements-swesmith.txt b/requirements-swesmith.txt new file mode 100644 index 000000000..b7f14f975 --- /dev/null +++ b/requirements-swesmith.txt @@ -0,0 +1,15 @@ +astor +ghapi +jupyter +libcst +litellm +matplotlib +modal +pre-commit +python-dotenv +sparklines +textual +tqdm +tree-sitter +tree-sitter-go +unidiff diff --git a/requirements.txt b/requirements.txt index bc82c345a..3ba137192 100644 --- a/requirements.txt +++ b/requirements.txt @@ -10,10 +10,6 @@ tiktoken docker==7.1.0 filelock==4.2.10 swebench==4.0.3 -swesmith==0.0.4 -# swesmith requires sglang, but sglang>0.5.2 pulls in heavy runtime -# dependencies (torch, flashinfer) that fail to build. -sglang==0.5.2 prompt_toolkit==3.0.51 anthropic==0.51.0 jinja2==3.1.6 From 7e633cc5b38b4f5bb5701a4dd765c7b622ca7d89 Mon Sep 17 00:00:00 2001 From: MarcCote <660004+MarcCote@users.noreply.github.com> Date: Wed, 18 Nov 2026 17:11:06 +0000 Subject: [PATCH 5/5] Clarify optional SWE-Smith dependency handling Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> --- debug_gym/gym/envs/swe_smith.py | 23 ++++++++++++++++------- requirements-swesmith.txt | 2 ++ 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/debug_gym/gym/envs/swe_smith.py b/debug_gym/gym/envs/swe_smith.py index 3c0293e97..de62b1461 100644 --- a/debug_gym/gym/envs/swe_smith.py +++ b/debug_gym/gym/envs/swe_smith.py @@ -11,6 +11,11 @@ from debug_gym.gym.terminals.terminal import DebugGymLogger from debug_gym.gym.utils import filter_problems +_SWESMITH_INSTALL_HELP = ( + "SWE-Smith support requires installing requirements-swesmith.txt " + "and swesmith==0.0.4 without dependencies." +) + class SWESmithEnv(SWEBenchEnv): CACHE = DEBUG_GYM_CACHE_DIR / "swe-smith" @@ -22,14 +27,14 @@ def setup_task(self): try: from swesmith.build_repo.download_images import DOCKER_ORG, TAG from swesmith.constants import MAP_REPO_TO_SPECS - from swesmith.harness.log_parsers import MAP_REPO_TO_PARSER, parse_log_pytest + from swesmith.harness.log_parsers import ( + MAP_REPO_TO_PARSER, + parse_log_pytest, + ) from swesmith.harness.utils import get_test_command from swesmith.utils import get_repo_commit_from_image_name except ImportError as exc: - raise ImportError( - "SWE-Smith support requires installing requirements-swesmith.txt " - "and swesmith==0.0.4 without dependencies." - ) from exc + raise ImportError(_SWESMITH_INSTALL_HELP) from exc self.base_commit = ( self.task_data["base_commit"] if "base_commit" in self.task_data else "main" @@ -200,6 +205,12 @@ def load_dataset( **kwargs, ) -> dict: logger = logger or DebugGymLogger("debug_gym") + if prepull_images: + try: + from swesmith.build_repo.download_images import DOCKER_ORG, TAG + except ImportError as exc: + raise ImportError(_SWESMITH_INSTALL_HELP) from exc + data_path = Path(dataset_id) if data_path.is_file(): # Loading from local file. @@ -237,8 +248,6 @@ def load_dataset( ) if prepull_images: - from swesmith.build_repo.download_images import DOCKER_ORG, TAG - # Download all images needed for SWE-Smith. client = docker.from_env() tagged_image_names = set( diff --git a/requirements-swesmith.txt b/requirements-swesmith.txt index b7f14f975..0f26f0aee 100644 --- a/requirements-swesmith.txt +++ b/requirements-swesmith.txt @@ -1,3 +1,5 @@ +# Install these in addition to requirements.txt. SWE-Smith's SGLang dependency +# is intentionally omitted because debug-gym does not use its inference server. astor ghapi jupyter