Coding Ninja commited on
Commit
f57e6a7
·
1 Parent(s): 0fd10c5

fix port 8000->7860 in app.py/openenv.yaml, add pyproject script entry, fix stubs

Browse files

- server/app.py: fix __main__ port 8000 -> 7860, extract main() fn, reload=False
- openenv.yaml: add app_port: 7860
- pyproject.toml: add [project.scripts] server entry point
- tests/openenv_test_stubs.py: add done/reward/metadata to Observation stub,
episode_id/step_count to State stub so integration tests work correctly

openenv.yaml CHANGED
@@ -38,6 +38,8 @@ evaluation:
38
  max: 1.0
39
  deterministic: true
40
 
 
 
41
  grading: normalized
42
  reproducible: true
43
 
 
38
  max: 1.0
39
  deterministic: true
40
 
41
+ app_port: 7860
42
+
43
  grading: normalized
44
  reproducible: true
45
 
pyproject.toml CHANGED
@@ -22,6 +22,9 @@ dependencies = [
22
  "httpx>=0.25",
23
  ]
24
 
 
 
 
25
  [project.optional-dependencies]
26
  dev = ["pytest", "httpx"]
27
 
 
22
  "httpx>=0.25",
23
  ]
24
 
25
+ [project.scripts]
26
+ server = "server.app:main"
27
+
28
  [project.optional-dependencies]
29
  dev = ["pytest", "httpx"]
30
 
server/app.py CHANGED
@@ -37,7 +37,11 @@ def list_tasks():
37
  }
38
 
39
 
40
- if __name__ == "__main__":
41
  import uvicorn
42
 
43
- uvicorn.run("server.app:app", host="0.0.0.0", port=8000, reload=True)
 
 
 
 
 
37
  }
38
 
39
 
40
+ def main() -> None:
41
  import uvicorn
42
 
43
+ uvicorn.run("server.app:app", host="0.0.0.0", port=7860, reload=False)
44
+
45
+
46
+ if __name__ == "__main__":
47
+ main()
tests/openenv_test_stubs.py CHANGED
@@ -2,6 +2,7 @@ from __future__ import annotations
2
 
3
  import sys
4
  import types
 
5
 
6
  from pydantic import BaseModel
7
 
@@ -16,10 +17,13 @@ def install_openenv_type_stubs() -> None:
16
  pass
17
 
18
  class Observation(BaseModel):
19
- pass
 
 
20
 
21
  class State(BaseModel):
22
- pass
 
23
 
24
  types_module.Action = Action
25
  types_module.Observation = Observation
 
2
 
3
  import sys
4
  import types
5
+ from typing import Any, Optional
6
 
7
  from pydantic import BaseModel
8
 
 
17
  pass
18
 
19
  class Observation(BaseModel):
20
+ done: bool = False
21
+ reward: Optional[float] = None
22
+ metadata: dict[str, Any] = {}
23
 
24
  class State(BaseModel):
25
+ episode_id: Optional[str] = None
26
+ step_count: int = 0
27
 
28
  types_module.Action = Action
29
  types_module.Observation = Observation