Skip to content

Commit 92ce026

Browse files
committed
Rename CodeInterpreter to Sandbox
1 parent b161bbf commit 92ce026

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+113
-113
lines changed

js/src/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
export * from 'e2b'
22

3-
export { CodeInterpreter, JupyterExtension } from './codeInterpreter'
3+
export { Sandbox, JupyterExtension } from './sandbox'
44

55
export type {
66
Logs,
@@ -27,6 +27,6 @@ export type {
2727
SuperGraph,
2828
PointData,
2929
} from './graphs'
30-
import { CodeInterpreter } from './codeInterpreter'
30+
import { Sandbox } from './sandbox'
3131

32-
export default CodeInterpreter
32+
export default Sandbox

js/src/codeInterpreter.ts renamed to js/src/sandbox.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ConnectionConfig, Sandbox, TimeoutError } from 'e2b'
1+
import { ConnectionConfig, Sandbox as BaseSandbox, TimeoutError } from 'e2b'
22

33
import { Result, Execution, OutputMessage, parseOutput, extractError } from './messaging'
44

@@ -292,12 +292,12 @@ export class JupyterExtension {
292292
/**
293293
* Code interpreter module for executing code in a stateful context.
294294
*/
295-
export class CodeInterpreter extends Sandbox {
295+
export class Sandbox extends BaseSandbox {
296296
protected static override readonly defaultTemplate: string = 'code-interpreter-beta'
297297
protected static readonly jupyterPort = 49999
298298

299299
readonly notebook = new JupyterExtension(
300-
`${this.connectionConfig.debug ? 'http' : 'https'}://${this.getHost(CodeInterpreter.jupyterPort)}`,
300+
`${this.connectionConfig.debug ? 'http' : 'https'}://${this.getHost(Sandbox.jupyterPort)}`,
301301
this.connectionConfig,
302302
)
303303
}

js/tests/benchmarking.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const { CodeInterpreter } = require('../dist')
1+
const { Sandbox } = require('../dist')
22
const dotenv = require('dotenv')
33
dotenv.config()
44

@@ -11,7 +11,7 @@ async function main() {
1111
for (let i = 0; i < iterations; i++) {
1212
console.log('Iteration:', i + 1)
1313
let startTime = new Date()
14-
const sandbox = await CodeInterpreter.create()
14+
const sandbox = await Sandbox.create()
1515
createSandboxTime += new Date() - startTime
1616

1717
startTime = new Date()

js/tests/envVars.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import { expect } from 'vitest'
22

33
import { isDebug, sandboxTest } from './setup'
4-
import { CodeInterpreter } from '../src'
4+
import { Sandbox } from '../src'
55

66
// Skip this test if we are running in debug mode — the pwd and user in the testing docker container are not the same as in the actual sandbox.
77
sandboxTest.skipIf(isDebug)('env vars', async () => {
8-
const sandbox = await CodeInterpreter.create({
8+
const sandbox = await Sandbox.create({
99
envs: { TEST_ENV_VAR: 'supertest' },
1010
})
1111
const result = await sandbox.notebook.execCell(
@@ -25,7 +25,7 @@ sandboxTest('env vars on sandbox', async ({ sandbox }) => {
2525
})
2626

2727
sandboxTest('env vars on sandbox override', async () => {
28-
const sandbox = await CodeInterpreter.create({
28+
const sandbox = await Sandbox.create({
2929
envs: { FOO: 'bar', SBX: 'value' },
3030
})
3131
await sandbox.notebook.execCell(

js/tests/reconnect.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { expect } from 'vitest'
22

3-
import { CodeInterpreter } from '../src'
3+
import { Sandbox } from '../src'
44
import { sandboxTest } from './setup'
55

66
sandboxTest('reconnect', async ({ sandbox }) => {
7-
sandbox = await CodeInterpreter.connect(sandbox.sandboxId)
7+
sandbox = await Sandbox.connect(sandbox.sandboxId)
88

99
const result = await sandbox.notebook.execCell('x =1; x')
1010

js/tests/runtimes/bun/run.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { expect, test } from 'bun:test'
22

3-
import { CodeInterpreter } from '../../../src'
3+
import { Sandbox } from '../../../src'
44

55
test('Bun test', async () => {
6-
const sbx = await CodeInterpreter.create({ timeoutMs: 5_000 })
6+
const sbx = await Sandbox.create({ timeoutMs: 5_000 })
77
try {
88
const result = await sbx.notebook.execCell('print("Hello, World!")')
99
expect(result.logs.stdout.join('')).toEqual('Hello, World!\n')

js/tests/runtimes/deno/run.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ import { load } from 'https://deno.land/[email protected]/dotenv/mod.ts'
33

44
await load({ envPath: '.env', export: true })
55

6-
import { CodeInterpreter } from '../../../dist/index.mjs'
6+
import { Sandbox } from '../../../dist/index.mjs'
77

88
Deno.test('Deno test', async () => {
9-
const sbx = await CodeInterpreter.create({ timeoutMs: 5_000 })
9+
const sbx = await Sandbox.create({ timeoutMs: 5_000 })
1010
try {
1111
const result = await sbx.notebook.execCell('print("Hello, World!")')
1212
assertEquals(result.logs.stdout.join(''), 'Hello, World!\n')

js/tests/setup.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
import { CodeInterpreter } from '../src'
1+
import { Sandbox } from '../src'
22
import { test as base } from 'vitest'
33

44
const timeoutMs = 60_000
55

66
interface SandboxFixture {
7-
sandbox: CodeInterpreter
7+
sandbox: Sandbox
88
}
99

1010
export const sandboxTest = base.extend<SandboxFixture>({
1111
sandbox: [
1212
async ({}, use) => {
13-
const sandbox = await CodeInterpreter.create({ timeoutMs })
13+
const sandbox = await Sandbox.create({ timeoutMs })
1414
try {
1515
await use(sandbox)
1616
} finally {

python/e2b_code_interpreter/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from e2b import *
2-
from .code_interpreter_sync import CodeInterpreter
3-
from .code_interpreter_async import AsyncCodeInterpreter
2+
from .code_interpreter_sync import Sandbox
3+
from .code_interpreter_async import AsyncSandbox
44
from .models import (
55
Execution,
66
ExecutionError,

python/e2b_code_interpreter/code_interpreter_async.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from typing import Optional, List, Dict
55
from httpx import AsyncHTTPTransport, AsyncClient
66

7-
from e2b import AsyncSandbox, ConnectionConfig
7+
from e2b import AsyncSandbox as BaseAsyncSandbox, ConnectionConfig
88

99
from e2b_code_interpreter.constants import (
1010
DEFAULT_KERNEL_ID,
@@ -236,7 +236,7 @@ async def list_kernels(
236236
raise format_request_timeout_error()
237237

238238

239-
class AsyncCodeInterpreter(AsyncSandbox):
239+
class AsyncSandbox(BaseAsyncSandbox):
240240
default_template = DEFAULT_TEMPLATE
241241
_jupyter_port = JUPYTER_PORT
242242

0 commit comments

Comments
 (0)