Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/breezy-bananas-lay.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@e2b/code-interpreter-template': patch
---

updated ijavascript kernel in the template
7 changes: 0 additions & 7 deletions js/tests/defaultKernels.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,3 @@ sandboxTest('test ts kernel', async ({ sandbox }) => {
)
expect(output.logs.stdout).toEqual(['Hello World!\n'])
})

sandboxTest('test ts kernel errors', async ({ sandbox }) => {
const output = await sandbox.runCode('import x from "module";', {
language: 'typescript',
})
expect(output.error?.name).toEqual('TypeScriptCompilerError')
})
8 changes: 0 additions & 8 deletions python/tests/async/test_async_default_kernels.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,3 @@ async def test_ts_kernel(async_sandbox: AsyncSandbox):
"const message: string = 'Hello, World!'; console.log(message);", language="ts"
)
assert execution.logs.stdout == ["Hello, World!\n"]


async def test_ts_kernel_errors(async_sandbox: AsyncSandbox):
execution = await async_sandbox.run_code(
"import x from 'module';", language="ts"
)
assert execution.error is not None
assert execution.error.name == "TypeScriptCompilerError"
5 changes: 0 additions & 5 deletions python/tests/sync/test_default_kernels.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,3 @@ def test_ts_kernel(sandbox: Sandbox):
execution = sandbox.run_code("const message: string = 'Hello, World!'; console.log(message)", language="ts")
assert execution.logs.stdout == ["Hello, World!\n"]


def test_ts_kernel_errors(sandbox: Sandbox):
execution = sandbox.run_code("import x from 'module';", language="ts")
assert execution.error is not None
assert execution.error.name == "TypeScriptCompilerError"
15 changes: 0 additions & 15 deletions template/.ts.swcrc

This file was deleted.

6 changes: 1 addition & 5 deletions template/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,9 @@ RUN R -e "install.packages('IRkernel', repos='https://cloud.r-project.org')"
RUN R -e "IRkernel::installspec(user = FALSE, name = 'r', displayname = 'R')"

# Javascript Kernel
RUN npm install -g --unsafe-perm ijavascript
RUN npm install -g --unsafe-perm git+https://github.com/e2b-dev/ijavascript.git
RUN ijsinstall --install=global

## TypeScript compiler
RUN npm install -g @swc/cli @swc/core
COPY .ts.swcrc $SERVER_PATH/.ts.swcrc

# Deno Kernel
COPY --from=denoland/deno:bin-2.0.4 /deno /usr/bin/deno
RUN chmod +x /usr/bin/deno
Expand Down
26 changes: 0 additions & 26 deletions template/server/messaging.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,32 +199,6 @@ async def execute(
+ code
)

if self.language == "typescript":
logger.info("Compiling TypeScript: %s", code)

# call SWC to compile the typescript code
try:
compile_result = subprocess.run("swc --config-file .ts.swcrc --filename index.ts".split(), input=code.encode(), capture_output=True)

if compile_result.returncode != 0:
logger.error("Error during TypeScript compilation: %s", compile_result.stderr.decode())
yield Error(
name="TypeScriptCompilerError",
value=compile_result.stderr.decode(),
traceback="",
)
return

code = compile_result.stdout.decode()
except Exception as e:
logger.error("Error starting SWC process: %s", e)
yield Error(
name="TypeScriptCompilerError",
value=str(e),
traceback="",
)
return

logger.info(code)
request = self._get_execute_request(message_id, code, False)

Expand Down
6 changes: 1 addition & 5 deletions template/test.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,9 @@ COPY ./template/requirements.txt requirements.txt
RUN pip install --no-cache-dir -r requirements.txt && ipython kernel install --name "python3" --user

# Javascript Kernel
RUN npm install -g --unsafe-perm ijavascript
RUN npm install -g --unsafe-perm git+https://github.com/e2b-dev/ijavascript.git
RUN ijsinstall --install=global

## TypeScript compiler
RUN npm install -g @swc/cli @swc/core
COPY ./template/.ts.swcrc $SERVER_PATH/.ts.swcrc

# Deno Kernel
COPY --from=denoland/deno:bin-2.0.4 /deno /usr/bin/deno
RUN chmod +x /usr/bin/deno
Expand Down
Loading