Skip to content

Commit dfa8448

Browse files
committed
feat: add Python and TypeScript sandbox implementations with of daytona experimentation
1 parent 3308b78 commit dfa8448

11 files changed

Lines changed: 2870 additions & 0 deletions

File tree

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.env*.local
2+
**/*/.env
3+
4+
node_modules

daytona/python/.python-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.12

daytona/python/README.md

Whitespace-only changes.

daytona/python/main.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import os
2+
3+
from daytona import Daytona, DaytonaConfig
4+
5+
# Define the configuration
6+
7+
config = DaytonaConfig(api_key=os.environ["DAYTONA_API_KEY"])
8+
9+
# Initialize the Daytona client
10+
11+
daytona = Daytona(config)
12+
13+
# Create the Sandbox instance
14+
15+
sandbox = daytona.create()
16+
17+
# Run the code securely inside the Sandbox
18+
19+
response = sandbox.process.code_run('print("Hello World from code!")')
20+
if response.exit_code != 0:
21+
print(f"Error: {response.exit_code} {response.result}")
22+
else:
23+
print(response.result)
24+
25+
# Clean up
26+
27+
sandbox.delete()

daytona/python/pyproject.toml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[project]
2+
name = "python"
3+
version = "0.1.0"
4+
description = "Add your description here"
5+
readme = "README.md"
6+
requires-python = ">=3.12"
7+
dependencies = [
8+
"daytona>=0.112.0",
9+
]

daytona/python/uv.lock

Lines changed: 968 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

daytona/typescript/.gitignore

Whitespace-only changes.

daytona/typescript/README.md

Whitespace-only changes.

daytona/typescript/index.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import "dotenv/config";
2+
import { Daytona } from "@daytonaio/sdk";
3+
4+
// Initialize the Daytona client
5+
const daytona = new Daytona({ apiKey: process.env.DAYTONA_API_KEY });
6+
7+
// Create the Sandbox instance
8+
const sandbox = await daytona.create({
9+
language: "typescript",
10+
});
11+
12+
// Run the code securely inside the Sandbox
13+
const response = await sandbox.process.codeRun(
14+
'console.log("Hello World from code!")',
15+
);
16+
console.log(response.result);
17+
18+
// Clean up
19+
await sandbox.delete();

daytona/typescript/package.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"scripts": {
3+
"dev": "node --experimental-strip-types index.ts"
4+
},
5+
"dependencies": {
6+
"@daytonaio/sdk": "^0.112.0",
7+
"dotenv": "^17.2.3",
8+
"ms": "^2.1.3"
9+
},
10+
"devDependencies": {
11+
"@types/ms": "^2.1.0",
12+
"@types/node": "^24.9.1"
13+
}
14+
}

0 commit comments

Comments
 (0)