Skip to content

armgit / E2B

Public Imported from GitHub
0

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

Fix import error [WIP]

Tomáš Valentaf1a328cedc5c
diff --git a/api-service/app.py b/api-service/app.py
index dfa2cb90d..3c919887d 100644
--- a/api-service/app.py
+++ b/api-service/app.py
@@ -7,7 +7,7 @@ from flask_cors import CORS
from codegen.base import generate_req_handler
from codegen.db.base import Database, DeploymentState
-from playground_client import NodeJSPlayground
+from playground_client.playground import NodeJSPlayground
url = os.environ.get("SUPABASE_URL")
key = os.environ.get("SUPABASE_KEY")
diff --git a/api-service/codegen/base.py b/api-service/codegen/base.py
index c6bc23649..314b91d00 100644
--- a/api-service/codegen/base.py
+++ b/api-service/codegen/base.py
@@ -1,5 +1,5 @@
from typing import List
-from playground_client import NodeJSPlayground
+from playground_client.playground import NodeJSPlayground
from langchain.llms.openai import OpenAIChat, OpenAI
from codegen.tools.documentation.tool import ReadDocumentation
diff --git a/api-service/codegen/tools/playground/main.py b/api-service/codegen/tools/playground/main.py
index f30add333..3a2ea869b 100644
--- a/api-service/codegen/tools/playground/main.py
+++ b/api-service/codegen/tools/playground/main.py
@@ -1,6 +1,6 @@
from typing import List
from langchain.tools.base import BaseTool
-from playground_client import NodeJSPlayground
+from playground_client.playground import NodeJSPlayground
from .tools.filesystem import PlaygroundFilesystemTool
from .tools.dependencies import PlaygroundDependenciesTool
diff --git a/api-service/codegen/tools/playground/tools/base.py b/api-service/codegen/tools/playground/tools/base.py
index 1531f0e87..366016743 100644
--- a/api-service/codegen/tools/playground/tools/base.py
+++ b/api-service/codegen/tools/playground/tools/base.py
@@ -1,5 +1,5 @@
from langchain.tools.base import BaseTool
-from playground_client import NodeJSPlayground
+from playground_client.playground import NodeJSPlayground
class PlaygroundBaseTool(BaseTool):
def __init__(self, playground: NodeJSPlayground) -> None:
diff --git a/api-service/codegen/tools/playground/tools/code.py b/api-service/codegen/tools/playground/tools/code.py
index df910c752..5a2e03d9d 100644
--- a/api-service/codegen/tools/playground/tools/code.py
+++ b/api-service/codegen/tools/playground/tools/code.py
@@ -1,5 +1,5 @@
from .base import PlaygroundBaseTool
-from playground_client import NodeJSPlayground
+from playground_client.playground import NodeJSPlayground
class PlaygroundJavaScriptTool(PlaygroundBaseTool):
diff --git a/api-service/codegen/tools/playground/tools/dependencies.py b/api-service/codegen/tools/playground/tools/dependencies.py
index cb8e4d043..f162c3e2b 100644
--- a/api-service/codegen/tools/playground/tools/dependencies.py
+++ b/api-service/codegen/tools/playground/tools/dependencies.py
@@ -1,5 +1,5 @@
from .base import PlaygroundBaseTool
-from playground_client import NodeJSPlayground
+from playground_client.playground import NodeJSPlayground
class PlaygroundDependenciesTool(PlaygroundBaseTool):
diff --git a/api-service/codegen/tools/playground/tools/filesystem.py b/api-service/codegen/tools/playground/tools/filesystem.py
index 93a441cb0..3756902b0 100644
--- a/api-service/codegen/tools/playground/tools/filesystem.py
+++ b/api-service/codegen/tools/playground/tools/filesystem.py
@@ -1,5 +1,5 @@
from .base import PlaygroundBaseTool
-from playground_client import NodeJSPlayground
+from playground_client.playground import NodeJSPlayground
class PlaygroundFilesystemTool(PlaygroundBaseTool):
diff --git a/api-service/codegen/tools/playground/tools/process.py b/api-service/codegen/tools/playground/tools/process.py
index eaecd0b2c..ea71e4a17 100644
--- a/api-service/codegen/tools/playground/tools/process.py
+++ b/api-service/codegen/tools/playground/tools/process.py
@@ -1,5 +1,5 @@
from .base import PlaygroundBaseTool
-from playground_client import NodeJSPlayground
+from playground_client.playground import NodeJSPlayground
class PlaygroundProcessTool(PlaygroundBaseTool):
diff --git a/api-service/playground_client/Makefile b/api-service/playground_client/Makefile
index 054727e5c..cacf965ac 100644
--- a/api-service/playground_client/Makefile
+++ b/api-service/playground_client/Makefile
@@ -1,3 +1,9 @@
generate:
rm -rf ./openapi_client
- npx @openapitools/openapi-generator-cli generate -i ../playground/swagger.json -g python-nextgen -o ./ --additional-properties=generateSourceCodeOnly=true --additional-properties=disallowAdditionalPropertiesIfNotPresent=false
+ npx @openapitools/openapi-generator-cli generate \
+ -i ../playground/swagger.json \
+ -g python-nextgen \
+ -o ./ \
+ --additional-properties=generateSourceCodeOnly=true \
+ --additional-properties=disallowAdditionalPropertiesIfNotPresent=false \
+ --additional-properties=projectName=playground_client
diff --git a/api-service/playground_client/__init__.py b/api-service/playground_client/__init__.py
deleted file mode 100644
index 778a7ab01..000000000
--- a/api-service/playground_client/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from .main import NodeJSPlayground
diff --git a/api-service/playground_client/openapi_client_README.md b/api-service/playground_client/openapi_client_README.md
index a69c82b95..05ee4007a 100644
--- a/api-service/playground_client/openapi_client_README.md
+++ b/api-service/playground_client/openapi_client_README.md
@@ -1,4 +1,4 @@
-# openapi-client
+# playground_client
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
The `openapi_client` package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
@@ -24,7 +24,7 @@ To be able to use it, you will need these dependencies in your own package that
## Getting Started
-In your own code, to use this library to connect and interact with openapi-client,
+In your own code, to use this library to connect and interact with playground_client,
you can run the following:
```python
diff --git a/api-service/playground_client/main.py b/api-service/playground_client/playground.py
similarity index 88%
rename from api-service/playground_client/main.py
rename to api-service/playground_client/playground.py
index 3123039a3..6af69987e 100644
--- a/api-service/playground_client/main.py
+++ b/api-service/playground_client/playground.py
@@ -1,10 +1,10 @@
-import openapi_client
-
from enum import Enum
from typing import TypedDict, Union
+from openapi_client import ApiClient, DefaultApi, Configuration
+from openapi_client import CreateSessionParams, RunProcessParams, WriteFilesystemFileParams
-configuration = openapi_client.Configuration(
+configuration = Configuration(
host="https://localhost:9001",
)
@@ -26,10 +26,10 @@ class CommandOutput(TypedDict):
class Playground:
def __init__(self, env_id: str):
- self.client = openapi_client.ApiClient(configuration)
- self.api = openapi_client.DefaultApi(self.client)
+ self.client = ApiClient(configuration)
+ self.api = DefaultApi(self.client)
self.session = self.api.create_session(
- openapi_client.CreateSessionParams(env_id)
+ CreateSessionParams(env_id)
)
self.is_closed = False
@@ -44,7 +44,7 @@ class Playground:
def run_command(self, cmd: str):
result = self.api.run_process(
- self.session.id, openapi_client.RunProcessParams(cmd)
+ self.session.id, RunProcessParams(cmd)
)
err_lines = [err.line for err in result.stderr]
out_lines = [out.line for out in result.stdout]
@@ -78,7 +78,7 @@ class Playground:
def write_file(self, path: str, content: str):
self.api.write_filesystem_file(
- self.session.id, path, openapi_client.WriteFilesystemFileParams(content)
+ self.session.id, path, WriteFilesystemFileParams(content)
)
def make_dir(self, path: str):