Skip to content

armgit / E2B

Public Imported from GitHub
0

Open-source, secure environment with real-world tools for enterprise-grade agents.

Update docstring in toml after CLI template build (#868)

Jakub Novákd90c201cf34a
diff --git a/.changeset/breezy-seals-play.md b/.changeset/breezy-seals-play.md
new file mode 100644
index 000000000..d00edcfdc
--- /dev/null
+++ b/.changeset/breezy-seals-play.md
@@ -0,0 +1,5 @@
+---
+'@e2b/cli': patch
+---
+
+Update text in toml for sync Python
diff --git a/packages/cli/src/commands/template/build.ts b/packages/cli/src/commands/template/build.ts
index 31f3fdbdd..2917d0126 100644
--- a/packages/cli/src/commands/template/build.ts
+++ b/packages/cli/src/commands/template/build.ts
@@ -480,7 +480,9 @@ async function waitForBuildFinish(
const pythonExample = asPython(`from e2b import Sandbox, AsyncSandbox
# Create sync sandbox
-sandbox = Sandbox("${aliases?.length ? aliases[0] : template.templateID}")
+sandbox = Sandbox.create("${
+ aliases?.length ? aliases[0] : template.templateID
+ }")
# Create async sandbox
sandbox = await AsyncSandbox.create("${
diff --git a/packages/cli/src/config/index.ts b/packages/cli/src/config/index.ts
index 4bb96e3ba..bc136d98b 100644
--- a/packages/cli/src/config/index.ts
+++ b/packages/cli/src/config/index.ts
@@ -16,7 +16,7 @@ function getConfigHeader(config: E2BConfig) {
# Python SDK
# from e2b import Sandbox, AsyncSandbox
-# sandbox = Sandbox("${
+# sandbox = Sandbox.create("${
config.template_name || config.template_id
}") # Sync sandbox
# sandbox = await AsyncSandbox.create("${
diff --git a/packages/python-sdk/tests/async/sandbox_async/test_snapshot.py b/packages/python-sdk/tests/async/sandbox_async/test_snapshot.py
index 3db48afd7..d5b7bce4e 100644
--- a/packages/python-sdk/tests/async/sandbox_async/test_snapshot.py
+++ b/packages/python-sdk/tests/async/sandbox_async/test_snapshot.py
@@ -11,5 +11,5 @@ async def test_snapshot(async_sandbox: AsyncSandbox):
resumed_sandbox = await async_sandbox.connect()
assert await async_sandbox.is_running()
- assert resumed_sandbox.is_running()
+ assert await resumed_sandbox.is_running()
assert resumed_sandbox.sandbox_id == async_sandbox.sandbox_id