MCPcopy Index your code
hub / github.com/e2b-dev/code-interpreter / CodeInterpreter

Class CodeInterpreter

python/e2b_code_interpreter/main.py:13–41  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11
12
13class CodeInterpreter(Sandbox):
14 template = "code-interpreter-stateful"
15
16 def __init__(
17 self,
18 template: Optional[str] = None,
19 api_key: Optional[str] = None,
20 cwd: Optional[str] = None,
21 env_vars: Optional[EnvVars] = None,
22 timeout: Optional[float] = TIMEOUT,
23 on_stdout: Optional[Callable[[ProcessMessage], Any]] = None,
24 on_stderr: Optional[Callable[[ProcessMessage], Any]] = None,
25 on_exit: Optional[Callable[[int], Any]] = None,
26 **kwargs,
27 ):
28 super().__init__(
29 template=template or self.template,
30 api_key=api_key,
31 cwd=cwd,
32 env_vars=env_vars,
33 timeout=timeout,
34 on_stdout=on_stdout,
35 on_stderr=on_stderr,
36 on_exit=on_exit,
37 **kwargs,
38 )
39 self.notebook = JupyterExtension(self)
40 # Close all the websocket connections when the interpreter is closed
41 self._process_cleanup.append(self.notebook.close)
42
43
44class JupyterExtension:

Callers 10

example.pyFile · 0.90
test_basicFunction · 0.90
test_create_new_kernelFunction · 0.90
test_restart_kernelFunction · 0.90
test_list_kernelsFunction · 0.90
benchmarking.pyFile · 0.90
test_bashFunction · 0.90
test_display_dataFunction · 0.90
test_statefulFunction · 0.90

Calls

no outgoing calls

Tested by 8

test_basicFunction · 0.72
test_create_new_kernelFunction · 0.72
test_restart_kernelFunction · 0.72
test_list_kernelsFunction · 0.72
test_bashFunction · 0.72
test_display_dataFunction · 0.72
test_statefulFunction · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…