Various Additions to the Documentation (#4139)

* Various docs improvements

* Update python/packages/autogen-core/docs/src/user-guide/core-user-guide/framework/command-line-code-executors.ipynb

---------

Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
This commit is contained in:
Gerardo Moreno 2024-11-11 12:23:25 -08:00 committed by GitHub
parent 0afde6da69
commit 3b8d0ddb67
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 21 additions and 14 deletions

View File

@ -14,22 +14,23 @@ poe check
``` ```
### Setup ### Setup
`uv` is a package manager that assists in creating the necessary environment and installing packages to run AutoGen.
- [Install `uv`](https://docs.astral.sh/uv/getting-started/installation/). - [Install `uv`](https://docs.astral.sh/uv/getting-started/installation/).
### Virtual environment ### Virtual Environment
During development, you may need to test changes made to any of the packages.\
To get a shell with the package available (virtual environment), To do so, create a virtual environment where the AutoGen packages are installed based on the current state of the directory.\
in the current directory, Run the following commands at the root level of the Python directory:
run:
```sh ```sh
uv sync --all-extras uv sync --all-extras
source .venv/bin/activate source .venv/bin/activate
``` ```
- `uv sync --all-extras` will create a `.venv` directory at the current level and install packages from the current directory along with any other dependencies. The `all-extras` flag adds optional dependencies.
- `source .venv/bin/activate` activates the virtual environment.
### Common tasks ### Common Tasks
To create a pull request (PR), ensure the following checks are met. You can run each check individually:
- Format: `poe format` - Format: `poe format`
- Lint: `poe lint` - Lint: `poe lint`
- Test: `poe test` - Test: `poe test`
@ -37,14 +38,15 @@ source .venv/bin/activate
- Pyright: `poe pyright` - Pyright: `poe pyright`
- Build docs: `poe --directory ./packages/autogen-core/ docs-build` - Build docs: `poe --directory ./packages/autogen-core/ docs-build`
- Auto rebuild+serve docs: `poe --directory ./packages/autogen-core/ docs-serve` - Auto rebuild+serve docs: `poe --directory ./packages/autogen-core/ docs-serve`
Alternatively, you can run all the checks with:
- `poe check`
> [!NOTE] > [!NOTE]
> These need to be run in the virtual environment. > These need to be run in the virtual environment.
### Creating a New Package
### Create new package To create a new package, similar to `autogen-core` or `autogen-chat`, use the following:
To create a new package, run:
```sh ```sh
uv sync uv sync

View File

@ -7,7 +7,7 @@
"# Command Line Code Executors\n", "# Command Line Code Executors\n",
"\n", "\n",
"Command line code execution is the simplest form of code execution.\n", "Command line code execution is the simplest form of code execution.\n",
"Generally speaking, it will save each code block to a file and the execute that file.\n", "Generally speaking, it will save each code block to a file and then execute that file.\n",
"This means that each code block is executed in a new process. There are two forms of this executor:\n", "This means that each code block is executed in a new process. There are two forms of this executor:\n",
"\n", "\n",
"- Docker ({py:class}`~autogen_ext.code_executor.docker_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",
@ -15,6 +15,11 @@
"\n", "\n",
"## Docker\n", "## Docker\n",
"\n", "\n",
"```{note}\n",
"To use `DockerCommandLineCodeExecutor`, ensure the `autogen-ext[docker]` package is installed. For more details, see the [Packages Documentation](https://microsoft.github.io/autogen/dev/packages/index.html).\n",
"\n",
"```\n",
"\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 {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", "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", "If the image is not found locally then the class will try to pull it. \n",