Skip to content

Commit

Permalink
rename docker subpackage
Browse files Browse the repository at this point in the history
  • Loading branch information
lpinheiroms committed Oct 11, 2024
1 parent 9cd4c60 commit 8b777bf
Show file tree
Hide file tree
Showing 12 changed files with 21 additions and 373 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@
"from autogen_agentchat.agents import CodeExecutorAgent, CodingAssistantAgent\n",
"from autogen_agentchat.teams import RoundRobinGroupChat, StopMessageTermination\n",
"from autogen_core.components.models import OpenAIChatCompletionClient\n",
"from autogen_ext.code_executor.docker_command_line_code_executor import DockerCommandLineCodeExecutor\n",
"from autogen_ext.code_executor.docker_executor import DockerCommandLineCodeExecutor\n",
"\n",
"async with DockerCommandLineCodeExecutor(work_dir=\"coding\") as code_executor: # type: ignore[syntax]\n",
" code_executor_agent = CodeExecutorAgent(\"code_executor\", code_executor=code_executor)\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ from autogen_agentchat import EVENT_LOGGER_NAME
from autogen_agentchat.agents import CodeExecutorAgent, CodingAssistantAgent
from autogen_agentchat.logging import ConsoleLogHandler
from autogen_agentchat.teams import RoundRobinGroupChat, StopMessageTermination
from autogen_ext.code_executor.docker_command_line_code_executor import DockerCommandLineCodeExecutor
from autogen_ext.code_executor.docker_executor import DockerCommandLineCodeExecutor
from autogen_core.components.models import OpenAIChatCompletionClient
logger = logging.getLogger(EVENT_LOGGER_NAME)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
")\n",
"from autogen_core.components.tool_agent import ToolAgent, ToolException, tool_agent_caller_loop\n",
"from autogen_core.components.tools import PythonCodeExecutionTool, ToolSchema\n",
"from autogen_ext.code_executor.docker_command_line_code_executor import DockerCommandLineCodeExecutor"
"from autogen_ext.code_executor.docker_executor import DockerCommandLineCodeExecutor"
]
},
{
Expand Down Expand Up @@ -157,7 +157,7 @@
"source": [
"In this example, we will use a tool for Python code execution.\n",
"First, we create a Docker-based command-line code executor\n",
"using {py:class}`~autogen_core.components.code_executor.DockerCommandLineCodeExecutor`,\n",
"using {py:class}`~autogen_core.components.code_executor.docker_executorCommandLineCodeExecutor`,\n",
"and then use it to instantiate a built-in Python code execution tool\n",
"{py:class}`~autogen_core.components.tools.PythonCodeExecutionTool`\n",
"that runs code in a Docker container."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
"Generally speaking, it will save each code block to a file and the execute that file.\n",
"This means that each code block is executed in a new process. There are two forms of this executor:\n",
"\n",
"- Docker ({py:class}`~autogen_ext.code_executor.docker_command_line_code_executor.DockerCommandLineCodeExecutor`) - this is where all commands are executed in a Docker container\n",
"- Docker ({py:class}`~autogen_ext.code_executor.docker_executor.DockerCommandLineCodeExecutor`) - this is where all commands are executed in a Docker container\n",
"- Local ({py:class}`~autogen_core.components.code_executor.LocalCommandLineCodeExecutor`) - this is where all commands are executed on the host machine\n",
"\n",
"## Docker\n",
"\n",
"The {py:class}`~autogen_ext.code_executor.docker_command_line_code_executor.DockerCommandLineCodeExecutor` will create a Docker container and run all commands within that container. \n",
"The {py:class}`~autogen_ext.code_executor.docker_executor.DockerCommandLineCodeExecutor` will create a Docker container and run all commands within that container. \n",
"The default image that is used is `python:3-slim`, this can be customized by passing the `image` parameter to the constructor. \n",
"If the image is not found locally then the class will try to pull it. \n",
"Therefore, having built the image locally is enough. The only thing required for this image to be compatible with the executor is to have `sh` and `python` installed. \n",
Expand Down Expand Up @@ -51,7 +51,7 @@
"\n",
"from autogen_core.base import CancellationToken\n",
"from autogen_core.components.code_executor import CodeBlock\n",
"from autogen_ext.code_executor.docker_command_line_code_executor import DockerCommandLineCodeExecutor\n",
"from autogen_ext.code_executor.docker_executor import DockerCommandLineCodeExecutor\n",
"\n",
"work_dir = Path(\"coding\")\n",
"work_dir.mkdir(exist_ok=True)\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"source": [
"from autogen_core.base import CancellationToken\n",
"from autogen_core.components.tools import PythonCodeExecutionTool\n",
"from autogen_ext.code_executor.docker_command_line_code_executor import DockerCommandLineCodeExecutor\n",
"from autogen_ext.code_executor.docker_executor import DockerCommandLineCodeExecutor\n",
"\n",
"# Create the tool.\n",
"code_executor = DockerCommandLineCodeExecutor()\n",
Expand All @@ -63,7 +63,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"The {py:class}`~autogen_core.components.code_executor.DockerCommandLineCodeExecutor`\n",
"The {py:class}`~autogen_core.components.code_executor.docker_executorCommandLineCodeExecutor`\n",
"class is a built-in code executor that runs Python code snippets in a subprocess\n",
"in the local command line environment.\n",
"The {py:class}`~autogen_core.components.tools.PythonCodeExecutionTool` class wraps the code executor\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@
"\n",
"from autogen_core.application import SingleThreadedAgentRuntime\n",
"from autogen_core.components.models import OpenAIChatCompletionClient\n",
"from autogen_ext.code_executor.docker_command_line_code_executor import DockerCommandLineCodeExecutor\n",
"from autogen_ext.code_executor.docker_executor import DockerCommandLineCodeExecutor\n",
"\n",
"work_dir = tempfile.mkdtemp()\n",
"\n",
Expand Down
2 changes: 1 addition & 1 deletion python/packages/autogen-core/samples/coding_pub_sub.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
UserMessage,
)
from autogen_core.components.tools import PythonCodeExecutionTool, Tool
from autogen_ext.code_executor.docker_command_line_code_executor import DockerCommandLineCodeExecutor
from autogen_ext.code_executor.docker_executor import DockerCommandLineCodeExecutor
from common.utils import get_chat_completion_client_from_envs


Expand Down
5 changes: 5 additions & 0 deletions python/packages/autogen-ext/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,8 @@ include = "../../shared_tasks.toml"

[tool.poe.tasks]
test = "pytest -n auto"

[tool.mypy]
[[tool.mypy.overrides]]
module = "docker.*"
ignore_missing_imports = true

This file was deleted.

Loading

0 comments on commit 8b777bf

Please sign in to comment.