You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.md 2.8 kB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. # AutoGen Python packages
  2. [![0.4 Docs](https://img.shields.io/badge/Docs-0.4-blue)](https://microsoft.github.io/autogen/dev/)
  3. [![PyPi autogen-core](https://img.shields.io/badge/PyPi-autogen--core-blue?logo=pypi)](https://pypi.org/project/autogen-core/) [![PyPi autogen-agentchat](https://img.shields.io/badge/PyPi-autogen--agentchat-blue?logo=pypi)](https://pypi.org/project/autogen-agentchat/) [![PyPi autogen-ext](https://img.shields.io/badge/PyPi-autogen--ext-blue?logo=pypi)](https://pypi.org/project/autogen-ext/)
  4. This directory works as a single `uv` workspace containing all project packages. See [`packages`](./packages/) to discover all project packages.
  5. ## Migrating from 0.2.x?
  6. Please refer to the [migration guide](./migration_guide.md) for how to migrate your code from 0.2.x to 0.4.x.
  7. ## Development
  8. **TL;DR**, run all checks with:
  9. ```sh
  10. uv sync --all-extras
  11. source .venv/bin/activate
  12. poe check
  13. ```
  14. ### Setup
  15. `uv` is a package manager that assists in creating the necessary environment and installing packages to run AutoGen.
  16. - [Install `uv`](https://docs.astral.sh/uv/getting-started/installation/).
  17. ### Virtual Environment
  18. During development, you may need to test changes made to any of the packages.\
  19. To do so, create a virtual environment where the AutoGen packages are installed based on the current state of the directory.\
  20. Run the following commands at the root level of the Python directory:
  21. ```sh
  22. uv sync --all-extras
  23. source .venv/bin/activate
  24. ```
  25. - `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.
  26. - `source .venv/bin/activate` activates the virtual environment.
  27. ### Common Tasks
  28. To create a pull request (PR), ensure the following checks are met. You can run each check individually:
  29. - Format: `poe format`
  30. - Lint: `poe lint`
  31. - Test: `poe test`
  32. - Mypy: `poe mypy`
  33. - Pyright: `poe pyright`
  34. - Build docs: `poe --directory ./packages/autogen-core/ docs-build`
  35. - Auto rebuild+serve docs: `poe --directory ./packages/autogen-core/ docs-serve`
  36. - Check samples in `python/samples`: `poe samples-code-check`
  37. Alternatively, you can run all the checks with:
  38. - `poe check`
  39. > [!NOTE]
  40. > These need to be run in the virtual environment.
  41. ### Syncing Dependencies
  42. When you pull new changes, you may need to update the dependencies.
  43. To do so, first make sure you are in the virtual environment, and then in the `python` directory, run:
  44. ```sh
  45. uv sync --all-extras
  46. ```
  47. This will update the dependencies in the virtual environment.
  48. ### Creating a New Package
  49. To create a new package, similar to `autogen-core` or `autogen-chat`, use the following:
  50. ```sh
  51. uv sync --python 3.12
  52. source .venv/bin/activate
  53. cookiecutter ./templates/new-package/
  54. ```