Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 426d7de

Browse files
matheperMarcCote
authored andcommittedMar 27, 2025·
init template from debug_gym module
1 parent cb6fa40 commit 426d7de

File tree

5 files changed

+12
-11
lines changed

5 files changed

+12
-11
lines changed
 

‎README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ To install the development dependencies:
1818

1919
First, create an LLM config template by running the `debug-gym-init-llm-config` entrypoint:
2020

21-
debug-gym-init-llm-config ~/.config/debug_gym
21+
python -m debug_gym.init_llm_config ~/.config/debug_gym
2222

2323
> [!TIP]
2424
> Run `debug-gym-init-llm-config --help` for more options. By default, the template is created at `~/.config/debug_gym/llm.yaml`, but you can specify any directory.

‎debug_gym/entrypoints.py ‎debug_gym/init_llm_config.py

+4
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,7 @@ def init_llm_config(dest_dir: str = None):
4848
print(f"LLM config template already exists at `{destination}`.")
4949

5050
print("Please edit the file to configure your LLM settings.")
51+
52+
53+
if __name__ == "__main__":
54+
init_llm_config()

‎pyproject.toml

-3
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,6 @@ dependencies = {file = ["requirements.txt"]}
2222
[tool.setuptools.packages.find]
2323
exclude = [".*tests.*", "exps/*", "output_*"]
2424

25-
[project.scripts]
26-
debug-gym-init-llm-config = "debug_gym.entrypoints:init_llm_config"
27-
2825
[project.optional-dependencies]
2926
dev = [
3027
"pytest",

‎tests/agents/test_llm_api.py

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import pytest
44
import yaml
5-
from openai import RateLimitError
65

76
from debug_gym.agents.llm_api import (
87
LLM,

‎tests/test_entrypoints.py ‎tests/test_init_llm_config.py

+7-6
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import pytest
44

55
from debug_gym.agents.llm_api import LLM_CONFIG_TEMPLATE
6-
from debug_gym.entrypoints import init_llm_config
6+
from debug_gym.init_llm_config import init_llm_config
77

88

99
@pytest.fixture
@@ -47,23 +47,24 @@ def test_init_llm_config_with_dest_named(tmp_path, mock_argv, capsys):
4747

4848

4949
def test_init_llm_config_override(tmp_path, monkeypatch, mock_argv, capsys):
50-
monkeypatch.setattr("debug_gym.entrypoints.LLM_CONFIG_TEMPLATE", "initial content")
50+
llm_template_path = "debug_gym.init_llm_config.LLM_CONFIG_TEMPLATE"
51+
monkeypatch.setattr(llm_template_path, "config")
5152

5253
destination = tmp_path / "destination"
5354
# os.makedirs(destination, exist_ok=True)
5455
destination_file = destination / "llm.yaml"
5556

5657
mock_argv(["--dest", str(destination)])
5758
init_llm_config() # First copy should work
58-
assert destination_file.read_text() == "initial content"
59+
assert destination_file.read_text() == "config"
5960
assert f"LLM config template created" in capsys.readouterr().out
6061

61-
monkeypatch.setattr("debug_gym.entrypoints.LLM_CONFIG_TEMPLATE", "new content")
62+
monkeypatch.setattr(llm_template_path, "new config")
6263
init_llm_config() # No force, should not override
63-
assert destination_file.read_text() == "initial content"
64+
assert destination_file.read_text() == "config"
6465
assert f"LLM config template already exists" in capsys.readouterr().out
6566

6667
mock_argv(["--dest", str(destination), "--force"])
6768
init_llm_config() # Force override
68-
assert destination_file.read_text() == "new content"
69+
assert destination_file.read_text() == "new config"
6970
assert f"LLM config template overridden" in capsys.readouterr().out

0 commit comments

Comments
 (0)
Please sign in to comment.