Spaces:
Running
Running
File size: 573 Bytes
37f9abc | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | import os
def build_sandbox_environment() -> dict[str, str]:
"""Create an environment isolated from the orchestrator's Python setup."""
environment = os.environ.copy()
# Do not expose the orchestrator's active virtual environment to uv.
environment.pop("VIRTUAL_ENV", None)
# Do not leak custom Python import/runtime configuration.
environment.pop("PYTHONPATH", None)
environment.pop("PYTHONHOME", None)
# Prevent imports from the user's global site-packages directory.
environment["PYTHONNOUSERSITE"] = "1"
return environment
|