Spaces:
Sleeping
Sleeping
Upload folder using huggingface_hub
Browse files- envs/repl_env/server/__init__.py +19 -0
- envs/repl_env/server/app.py +18 -0
- server/__init__.py +19 -0
- server/app.py +18 -0
envs/repl_env/server/__init__.py
CHANGED
|
@@ -10,6 +10,25 @@ REPL Environment Server Components.
|
|
| 10 |
This module contains the server-side implementation of the REPL environment.
|
| 11 |
"""
|
| 12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
from .python_executor import PythonExecutor
|
| 14 |
from .repl_environment import REPLEnvironment
|
| 15 |
|
|
|
|
| 10 |
This module contains the server-side implementation of the REPL environment.
|
| 11 |
"""
|
| 12 |
|
| 13 |
+
import sys
|
| 14 |
+
from pathlib import Path
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
def _prefer_bundled_openenv_src() -> None:
|
| 18 |
+
"""Ensure bundled src/openenv wins over installed openenv-core wheels."""
|
| 19 |
+
for parent in Path(__file__).resolve().parents:
|
| 20 |
+
src_dir = parent / "src"
|
| 21 |
+
if not (src_dir / "openenv").is_dir():
|
| 22 |
+
continue
|
| 23 |
+
src_path = str(src_dir)
|
| 24 |
+
if src_path in sys.path:
|
| 25 |
+
sys.path.remove(src_path)
|
| 26 |
+
sys.path.insert(0, src_path)
|
| 27 |
+
return
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
_prefer_bundled_openenv_src()
|
| 31 |
+
|
| 32 |
from .python_executor import PythonExecutor
|
| 33 |
from .repl_environment import REPLEnvironment
|
| 34 |
|
envs/repl_env/server/app.py
CHANGED
|
@@ -38,6 +38,24 @@ Environment Variables:
|
|
| 38 |
import inspect
|
| 39 |
import logging
|
| 40 |
import os
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
|
| 42 |
try:
|
| 43 |
from openenv.core.env_server.http_server import create_app
|
|
|
|
| 38 |
import inspect
|
| 39 |
import logging
|
| 40 |
import os
|
| 41 |
+
import sys
|
| 42 |
+
from pathlib import Path
|
| 43 |
+
|
| 44 |
+
|
| 45 |
+
def _prefer_bundled_openenv_src() -> None:
|
| 46 |
+
"""Ensure the bundled repo src/ tree wins over installed openenv-core wheels."""
|
| 47 |
+
for parent in Path(__file__).resolve().parents:
|
| 48 |
+
src_dir = parent / "src"
|
| 49 |
+
if not (src_dir / "openenv").is_dir():
|
| 50 |
+
continue
|
| 51 |
+
src_path = str(src_dir)
|
| 52 |
+
if src_path in sys.path:
|
| 53 |
+
sys.path.remove(src_path)
|
| 54 |
+
sys.path.insert(0, src_path)
|
| 55 |
+
return
|
| 56 |
+
|
| 57 |
+
|
| 58 |
+
_prefer_bundled_openenv_src()
|
| 59 |
|
| 60 |
try:
|
| 61 |
from openenv.core.env_server.http_server import create_app
|
server/__init__.py
CHANGED
|
@@ -10,6 +10,25 @@ REPL Environment Server Components.
|
|
| 10 |
This module contains the server-side implementation of the REPL environment.
|
| 11 |
"""
|
| 12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
from .python_executor import PythonExecutor
|
| 14 |
from .repl_environment import REPLEnvironment
|
| 15 |
|
|
|
|
| 10 |
This module contains the server-side implementation of the REPL environment.
|
| 11 |
"""
|
| 12 |
|
| 13 |
+
import sys
|
| 14 |
+
from pathlib import Path
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
def _prefer_bundled_openenv_src() -> None:
|
| 18 |
+
"""Ensure bundled src/openenv wins over installed openenv-core wheels."""
|
| 19 |
+
for parent in Path(__file__).resolve().parents:
|
| 20 |
+
src_dir = parent / "src"
|
| 21 |
+
if not (src_dir / "openenv").is_dir():
|
| 22 |
+
continue
|
| 23 |
+
src_path = str(src_dir)
|
| 24 |
+
if src_path in sys.path:
|
| 25 |
+
sys.path.remove(src_path)
|
| 26 |
+
sys.path.insert(0, src_path)
|
| 27 |
+
return
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
_prefer_bundled_openenv_src()
|
| 31 |
+
|
| 32 |
from .python_executor import PythonExecutor
|
| 33 |
from .repl_environment import REPLEnvironment
|
| 34 |
|
server/app.py
CHANGED
|
@@ -38,6 +38,24 @@ Environment Variables:
|
|
| 38 |
import inspect
|
| 39 |
import logging
|
| 40 |
import os
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
|
| 42 |
try:
|
| 43 |
from openenv.core.env_server.http_server import create_app
|
|
|
|
| 38 |
import inspect
|
| 39 |
import logging
|
| 40 |
import os
|
| 41 |
+
import sys
|
| 42 |
+
from pathlib import Path
|
| 43 |
+
|
| 44 |
+
|
| 45 |
+
def _prefer_bundled_openenv_src() -> None:
|
| 46 |
+
"""Ensure the bundled repo src/ tree wins over installed openenv-core wheels."""
|
| 47 |
+
for parent in Path(__file__).resolve().parents:
|
| 48 |
+
src_dir = parent / "src"
|
| 49 |
+
if not (src_dir / "openenv").is_dir():
|
| 50 |
+
continue
|
| 51 |
+
src_path = str(src_dir)
|
| 52 |
+
if src_path in sys.path:
|
| 53 |
+
sys.path.remove(src_path)
|
| 54 |
+
sys.path.insert(0, src_path)
|
| 55 |
+
return
|
| 56 |
+
|
| 57 |
+
|
| 58 |
+
_prefer_bundled_openenv_src()
|
| 59 |
|
| 60 |
try:
|
| 61 |
from openenv.core.env_server.http_server import create_app
|