burtenshaw HF Staff commited on
Commit
8a84af0
·
verified ·
1 Parent(s): 8b900a4

Upload folder using huggingface_hub

Browse files
Files changed (5) hide show
  1. Dockerfile +2 -2
  2. README.md +1 -18
  3. pyproject.toml +1 -1
  4. server/app.py +12 -7
  5. uv.lock +0 -0
Dockerfile CHANGED
@@ -16,8 +16,8 @@ RUN apt-get update && apt-get install -y \
16
  # Copy coding_env package
17
  COPY envs/coding_env/ ./envs/coding_env/
18
 
19
- # Install openenv-core first from PyPI, then coding_env
20
- RUN pip install --no-cache-dir "openenv-core[core] @ git+https://github.com/meta-pytorch/OpenEnv.git@v0.2.3" && \
21
  pip install --no-cache-dir ./envs/coding_env/
22
 
23
  # Environment variables
 
16
  # Copy coding_env package
17
  COPY envs/coding_env/ ./envs/coding_env/
18
 
19
+ # Install openenv first from PyPI, then coding_env
20
+ RUN pip install --no-cache-dir "openenv[core]>=0.2.2" && \
21
  pip install --no-cache-dir ./envs/coding_env/
22
 
23
  # Environment variables
README.md CHANGED
@@ -2,32 +2,15 @@
2
  title: Coding Environment Server
3
  emoji: 💻
4
  colorFrom: blue
5
- colorTo: green
6
  sdk: docker
7
  pinned: false
8
  app_port: 8000
9
  base_path: /web
10
  tags:
11
- - openenv-0.2.3
12
  - openenv
13
  ---
14
 
15
- ## Hugging Face Space Deployment
16
-
17
- This Space is built from OpenEnv environment `coding_env`.
18
-
19
- - Space URL: `https://huggingface.co/spaces/openenv/coding_env`
20
- - OpenEnv pinned ref: `0.2.3`
21
- - Hub tag: `openenv`
22
-
23
- ### Connecting from Code
24
-
25
- ```python
26
- from envs.coding_env import CodingEnv
27
-
28
- env = CodingEnv(base_url="https://huggingface.co/spaces/openenv/coding_env")
29
- ```
30
-
31
  # Coding Environment
32
 
33
  A Python code execution environment that runs arbitrary Python code and returns results. Perfect for testing code execution infrastructure and demonstrating environment usage patterns.
 
2
  title: Coding Environment Server
3
  emoji: 💻
4
  colorFrom: blue
5
+ colorTo: blue
6
  sdk: docker
7
  pinned: false
8
  app_port: 8000
9
  base_path: /web
10
  tags:
 
11
  - openenv
12
  ---
13
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
  # Coding Environment
15
 
16
  A Python code execution environment that runs arbitrary Python code and returns results. Perfect for testing code execution infrastructure and demonstrating environment usage patterns.
pyproject.toml CHANGED
@@ -8,7 +8,7 @@ version = "0.1.0"
8
  description = "Coding Environment for OpenEnv"
9
  requires-python = ">=3.10"
10
  dependencies = [
11
- "openenv-core[core] @ git+https://github.com/meta-pytorch/OpenEnv.git@v0.2.3",
12
  "fastapi>=0.115.0",
13
  "pydantic>=2.0.0",
14
  "uvicorn[standard]>=0.24.0",
 
8
  description = "Coding Environment for OpenEnv"
9
  requires-python = ">=3.10"
10
  dependencies = [
11
+ "openenv[core]>=0.2.2",
12
  "fastapi>=0.115.0",
13
  "pydantic>=2.0.0",
14
  "uvicorn[standard]>=0.24.0",
server/app.py CHANGED
@@ -21,6 +21,9 @@ Usage:
21
  python -m envs.coding_env.server.app
22
  """
23
 
 
 
 
24
  from coding_env.models import CodeAction, CodeObservation
25
  from coding_env.server.python_codeact_env import PythonCodeActEnv
26
  from openenv.core.env_server import create_app
@@ -30,17 +33,19 @@ from openenv.core.env_server import create_app
30
  app = create_app(PythonCodeActEnv, CodeAction, CodeObservation, env_name="coding_env")
31
 
32
 
33
- if __name__ == "__main__":
34
- import uvicorn
35
-
36
- uvicorn.run(app, host="0.0.0.0", port=8000)
37
-
38
-
39
  def main():
40
  """Main entry point for running the server."""
41
  import uvicorn
42
 
43
- uvicorn.run(app, host="0.0.0.0", port=8000)
 
 
 
 
 
 
 
 
44
 
45
 
46
  if __name__ == "__main__":
 
21
  python -m envs.coding_env.server.app
22
  """
23
 
24
+ import os
25
+ from contextlib import suppress
26
+
27
  from coding_env.models import CodeAction, CodeObservation
28
  from coding_env.server.python_codeact_env import PythonCodeActEnv
29
  from openenv.core.env_server import create_app
 
33
  app = create_app(PythonCodeActEnv, CodeAction, CodeObservation, env_name="coding_env")
34
 
35
 
 
 
 
 
 
 
36
  def main():
37
  """Main entry point for running the server."""
38
  import uvicorn
39
 
40
+ port = int(os.environ.get("SBX_SERVICE_PORT", "8000"))
41
+ if proxy_dir := os.environ.get("SBX_PROXY_DIR"):
42
+ socket_path = os.path.join(proxy_dir, f"{port}.sock")
43
+ os.makedirs(proxy_dir, exist_ok=True)
44
+ with suppress(FileNotFoundError):
45
+ os.unlink(socket_path)
46
+ uvicorn.run(app, uds=socket_path)
47
+ else:
48
+ uvicorn.run(app, host="0.0.0.0", port=port)
49
 
50
 
51
  if __name__ == "__main__":
uv.lock ADDED
The diff for this file is too large to render. See raw diff