databoysu commited on
Commit
8f66ad1
Β·
1 Parent(s): 43e60bf

reorganization done

Browse files
.gitignore CHANGED
@@ -9,4 +9,7 @@ node_modules/
9
  package.json
10
  package-lock.json
11
  .github/
12
- .agent/
 
 
 
 
9
  package.json
10
  package-lock.json
11
  .github/
12
+ .agent/
13
+ **/__pycache__/
14
+ **/.venv/
15
+ **/node_modules/
Dockerfile CHANGED
@@ -48,6 +48,8 @@ HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
48
 
49
  EXPOSE 7860
50
 
 
 
51
  USER appuser
52
 
53
- CMD ["sh", "-c", "cd /app/env && python app.py"]
 
48
 
49
  EXPOSE 7860
50
 
51
+ WORKDIR /app/env
52
+
53
  USER appuser
54
 
55
+ CMD ["python", "vision_ui.py"]
README.md CHANGED
@@ -5,6 +5,7 @@ colorFrom: blue
5
  sdk: docker
6
  pinned: false
7
  app_port: 7860
 
8
  base_path: /web
9
  tags:
10
  - openenv
@@ -54,7 +55,7 @@ Every task contains: `name`, `description`, `difficulty`, `bug_type`, `code` (bu
54
 
55
  This environment enforces strict typing and uses standard modern tooling:
56
  - **`uv`:** Handles dependency management (see `pyproject.toml`).
57
- - **FastAPI:** Provides the `server.app` integration layer for OpenEnv compliance.
58
  - **Pydantic (v2):** Provides strong validation layers for `models.py` (e.g., `CodeAction`, `CodeObservation`).
59
  - **OpenEnv Config:** See `openenv.yaml` which specifies `tracefix_rl` to run the FastAPI app on port `7860`.
60
 
@@ -63,7 +64,7 @@ This environment enforces strict typing and uses standard modern tooling:
63
  - `tasks.py`: Task metadata definitions.
64
  - `sandbox.py`: Subprocess runtime and output tracking.
65
  - `environment.py`: Reset/step/reward core RL loop logic (`TraceFixRLGym`).
66
- - `server/tracefix_rl_environment.py` / `server/app.py`: Maps the OpenAI/OpenEnv network interface to the core environment.
67
  - `inference.py`: Baseline OpenAI-client inference script to evaluate agents.
68
 
69
  ## Local Development
 
5
  sdk: docker
6
  pinned: false
7
  app_port: 7860
8
+ app_file: vision_ui.py
9
  base_path: /web
10
  tags:
11
  - openenv
 
55
 
56
  This environment enforces strict typing and uses standard modern tooling:
57
  - **`uv`:** Handles dependency management (see `pyproject.toml`).
58
+ - **FastAPI:** Provides the `backend.app` integration layer for OpenEnv compliance.
59
  - **Pydantic (v2):** Provides strong validation layers for `models.py` (e.g., `CodeAction`, `CodeObservation`).
60
  - **OpenEnv Config:** See `openenv.yaml` which specifies `tracefix_rl` to run the FastAPI app on port `7860`.
61
 
 
64
  - `tasks.py`: Task metadata definitions.
65
  - `sandbox.py`: Subprocess runtime and output tracking.
66
  - `environment.py`: Reset/step/reward core RL loop logic (`TraceFixRLGym`).
67
+ - `backend/tracefix_rl_environment.py` / `backend/app.py`: Maps the OpenAI/OpenEnv network interface to the core environment.
68
  - `inference.py`: Baseline OpenAI-client inference script to evaluate agents.
69
 
70
  ## Local Development
__init__.py CHANGED
@@ -1,7 +1,7 @@
1
  """TraceFix-RL OpenEnv package."""
2
 
3
- from .client import MyEnv, TraceFixRLEnv
4
- from .models import CodeAction, CodeObservation, TestResult
5
 
6
  __all__ = [
7
  "CodeAction",
 
1
  """TraceFix-RL OpenEnv package."""
2
 
3
+ from .core.client import MyEnv, TraceFixRLEnv
4
+ from .core.models import CodeAction, CodeObservation, TestResult
5
 
6
  __all__ = [
7
  "CodeAction",
{server β†’ backend}/__init__.py RENAMED
@@ -1,4 +1,4 @@
1
- """TraceFix-RL server components."""
2
 
3
  from .tracefix_rl_environment import TraceFixRLEnvironment
4
 
 
1
+ """TraceFix-RL backend components."""
2
 
3
  from .tracefix_rl_environment import TraceFixRLEnvironment
4
 
{server β†’ backend}/app.py RENAMED
@@ -8,15 +8,15 @@ except Exception as e: # pragma: no cover
8
  ) from e
9
 
10
  try:
11
- from ..models import CodeAction, CodeObservation
12
- from .tracefix_rl_environment import TraceFixRLEnvironment
13
  except ImportError:
14
  import sys
15
  from pathlib import Path
16
 
17
  sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
18
- from models import CodeAction, CodeObservation
19
- from server.tracefix_rl_environment import TraceFixRLEnvironment
20
 
21
 
22
  app = create_app(
 
8
  ) from e
9
 
10
  try:
11
+ from core.models import CodeAction, CodeObservation
12
+ from backend.tracefix_rl_environment import TraceFixRLEnvironment
13
  except ImportError:
14
  import sys
15
  from pathlib import Path
16
 
17
  sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
18
+ from core.models import CodeAction, CodeObservation
19
+ from backend.tracefix_rl_environment import TraceFixRLEnvironment
20
 
21
 
22
  app = create_app(
{server β†’ backend}/tracefix_rl_environment.py RENAMED
@@ -4,11 +4,11 @@ from openenv.core.env_server.interfaces import Environment
4
  from openenv.core.env_server.types import State
5
 
6
  try:
7
- from ..environment import TraceFixRLGym
8
- from ..models import CodeAction, CodeObservation
9
  except ImportError:
10
- from environment import TraceFixRLGym
11
- from models import CodeAction, CodeObservation
12
 
13
 
14
  class TraceFixRLEnvironment(Environment):
 
4
  from openenv.core.env_server.types import State
5
 
6
  try:
7
+ from core.environment import TraceFixRLGym
8
+ from core.models import CodeAction, CodeObservation
9
  except ImportError:
10
+ from core.environment import TraceFixRLGym
11
+ from core.models import CodeAction, CodeObservation
12
 
13
 
14
  class TraceFixRLEnvironment(Environment):
core/__init__.py ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Core domain package for TraceFix-RL."""
2
+
3
+ from .client import MyEnv, TraceFixRLEnv
4
+ from .environment import TraceFixRLGym
5
+ from .models import CodeAction, CodeObservation, TestResult
6
+
7
+ __all__ = [
8
+ "CodeAction",
9
+ "CodeObservation",
10
+ "TestResult",
11
+ "TraceFixRLEnv",
12
+ "MyEnv",
13
+ "TraceFixRLGym",
14
+ ]
client.py β†’ core/client.py RENAMED
@@ -9,7 +9,7 @@ from openenv.core.env_server.types import State
9
  try:
10
  from .models import CodeAction, CodeObservation, TestResult
11
  except ImportError:
12
- from models import CodeAction, CodeObservation, TestResult
13
 
14
 
15
  class TraceFixRLEnv(
 
9
  try:
10
  from .models import CodeAction, CodeObservation, TestResult
11
  except ImportError:
12
+ from core.models import CodeAction, CodeObservation, TestResult
13
 
14
 
15
  class TraceFixRLEnv(
context.py β†’ core/context.py RENAMED
File without changes
environment.py β†’ core/environment.py RENAMED
@@ -11,12 +11,12 @@ try:
11
  from .context import extract_error_line, get_localized_context
12
  from .models import CodeAction, CodeObservation, TestResult
13
  from .sandbox import check_syntax, run_code_with_tests
14
- from .tasks import ALL_TASKS, TASKS_BY_DIFFICULTY
15
  except ImportError:
16
- from context import extract_error_line, get_localized_context
17
- from models import CodeAction, CodeObservation, TestResult
18
- from sandbox import check_syntax, run_code_with_tests
19
- from tasks import ALL_TASKS, TASKS_BY_DIFFICULTY
20
 
21
 
22
  R_SUBMIT_ALL_PASS = +1.00
 
11
  from .context import extract_error_line, get_localized_context
12
  from .models import CodeAction, CodeObservation, TestResult
13
  from .sandbox import check_syntax, run_code_with_tests
14
+ from tasks.tasks import ALL_TASKS, TASKS_BY_DIFFICULTY
15
  except ImportError:
16
+ from core.context import extract_error_line, get_localized_context
17
+ from core.models import CodeAction, CodeObservation, TestResult
18
+ from core.sandbox import check_syntax, run_code_with_tests
19
+ from tasks.tasks import ALL_TASKS, TASKS_BY_DIFFICULTY
20
 
21
 
22
  R_SUBMIT_ALL_PASS = +1.00
models.py β†’ core/models.py RENAMED
File without changes
sandbox.py β†’ core/sandbox.py RENAMED
@@ -42,7 +42,7 @@ from typing import Any, Callable, Dict, List, Set, Tuple
42
  try:
43
  from .models import TestResult
44
  except ImportError:
45
- from models import TestResult
46
 
47
 
48
 
 
42
  try:
43
  from .models import TestResult
44
  except ImportError:
45
+ from core.models import TestResult
46
 
47
 
48
 
inference.py CHANGED
@@ -33,8 +33,8 @@ except Exception:
33
  ROOT_DIR = Path(__file__).resolve().parent
34
  if str(ROOT_DIR) not in sys.path:
35
  sys.path.insert(0, str(ROOT_DIR))
36
- from client import TraceFixRLEnv
37
- from models import CodeAction
38
 
39
 
40
  API_BASE_URL = os.getenv("API_BASE_URL", "https://router.huggingface.co/v1")
 
33
  ROOT_DIR = Path(__file__).resolve().parent
34
  if str(ROOT_DIR) not in sys.path:
35
  sys.path.insert(0, str(ROOT_DIR))
36
+ from core.client import TraceFixRLEnv
37
+ from core.models import CodeAction
38
 
39
 
40
  API_BASE_URL = os.getenv("API_BASE_URL", "https://router.huggingface.co/v1")
openenv.yaml CHANGED
@@ -2,5 +2,5 @@ spec_version: 1
2
  name: tracefix_rl
3
  type: space
4
  runtime: fastapi
5
- app: server.app:app
6
  port: 7860
 
2
  name: tracefix_rl
3
  type: space
4
  runtime: fastapi
5
+ app: backend.app:app
6
  port: 7860
pyproject.toml CHANGED
@@ -38,10 +38,10 @@ dev = [
38
 
39
  [project.scripts]
40
  # Server entry point - enables running via: uv run --project . server
41
- # or: python -m tracefix_rl.server.app
42
- server = "tracefix_rl.server.app:main"
43
 
44
  [tool.setuptools]
45
  include-package-data = true
46
- packages = ["tracefix_rl", "tracefix_rl.server"]
47
- package-dir = { "tracefix_rl" = ".", "tracefix_rl.server" = "server" }
 
38
 
39
  [project.scripts]
40
  # Server entry point - enables running via: uv run --project . server
41
+ # or: python -m tracefix_rl.backend.app
42
+ server = "tracefix_rl.backend.app:main"
43
 
44
  [tool.setuptools]
45
  include-package-data = true
46
+ packages = ["tracefix_rl", "tracefix_rl.backend", "tracefix_rl.core", "tracefix_rl.tasks"]
47
+ package-dir = { "tracefix_rl" = ".", "tracefix_rl.backend" = "backend", "tracefix_rl.core" = "core", "tracefix_rl.tasks" = "tasks" }
server/__pycache__/__init__.cpython-312.pyc DELETED
Binary file (309 Bytes)
 
server/__pycache__/app.cpython-312.pyc DELETED
Binary file (1.76 kB)
 
server/__pycache__/my_env_environment.cpython-312.pyc DELETED
Binary file (2.85 kB)
 
tasks/__init__.py ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ """Task registry package for TraceFix-RL."""
2
+
3
+ from .tasks import ALL_TASKS, TASKS_BY_DIFFICULTY
4
+
5
+ __all__ = ["ALL_TASKS", "TASKS_BY_DIFFICULTY"]
tasks.py β†’ tasks/tasks.py RENAMED
File without changes
app.py β†’ vision_ui.py RENAMED
@@ -19,8 +19,10 @@ from typing import Any, Generator
19
  import gradio as gr
20
 
21
  try:
22
- from tasks import ALL_TASKS
 
23
  except Exception:
 
24
  ALL_TASKS = []
25
 
26
 
@@ -308,7 +310,7 @@ def _start_backend_server() -> None:
308
  backend_env["PORT"] = str(BACKEND_PORT)
309
 
310
  subprocess.Popen(
311
- [sys.executable, "-m", "server.app"],
312
  cwd=str(ROOT_DIR),
313
  env=backend_env,
314
  stdout=subprocess.DEVNULL,
 
19
  import gradio as gr
20
 
21
  try:
22
+ from tasks import tasks
23
+ ALL_TASKS = tasks.ALL_TASKS
24
  except Exception:
25
+ tasks = None
26
  ALL_TASKS = []
27
 
28
 
 
310
  backend_env["PORT"] = str(BACKEND_PORT)
311
 
312
  subprocess.Popen(
313
+ ["python", "-m", "backend.app"],
314
  cwd=str(ROOT_DIR),
315
  env=backend_env,
316
  stdout=subprocess.DEVNULL,