MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / exec_python

Method exec_python

python/openshell/sandbox.py:560–585  ·  view source on GitHub ↗
(
        self,
        sandbox_id: str,
        function: Callable[..., object],
        *,
        args: Sequence[object] = (),
        kwargs: Mapping[str, object] | None = None,
        stream_output: bool = False,
        workdir: str | None = None,
        env: Mapping[str, str] | None = None,
        timeout_seconds: int | None = None,
    )

Source from the content-addressed store, hash-verified

558 return result
559
560 def exec_python(
561 self,
562 sandbox_id: str,
563 function: Callable[..., object],
564 *,
565 args: Sequence[object] = (),
566 kwargs: Mapping[str, object] | None = None,
567 stream_output: bool = False,
568 workdir: str | None = None,
569 env: Mapping[str, str] | None = None,
570 timeout_seconds: int | None = None,
571 ) -> ExecResult:
572 exec_env = dict(env or {})
573 exec_env["OPENSHELL_PYFUNC_B64"] = _serialize_python_callable(
574 function,
575 args=args,
576 kwargs=kwargs,
577 )
578 return self.exec(
579 sandbox_id,
580 [_SANDBOX_PYTHON_BIN, "-c", _PYTHON_CLOUDPICKLE_BOOTSTRAP],
581 stream_output=stream_output,
582 workdir=workdir,
583 env=exec_env,
584 timeout_seconds=timeout_seconds,
585 )
586
587
588@dataclass(frozen=True)

Callers

nothing calls this directly

Calls 2

execMethod · 0.95

Tested by

no test coverage detected