From 798d16a6c63236f4bb269d518d52cfefd9c03733 Mon Sep 17 00:00:00 2001 From: Eduardo Chiarotti Date: Wed, 16 Oct 2024 18:58:08 -0300 Subject: [PATCH] feat: ADd warning from poetry -> uv (#1458) --- README.md | 6 ++++++ src/crewai/cli/run_crew.py | 19 +++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/README.md b/README.md index 21ab34390..f79f2a011 100644 --- a/README.md +++ b/README.md @@ -252,6 +252,12 @@ or python src/my_project/main.py ``` +If an error happens due to the usage of poetry, please run the following command to update your crewai package: + +```bash +crewai update +``` + You should see the output in the console and the `report.md` file should be created in the root of your project with the full final report. In addition to the sequential process, you can use the hierarchical process, which automatically assigns a manager to the defined crew to properly coordinate the planning and execution of tasks through delegation and validation of results. [See more about the processes here](https://docs.crewai.com/core-concepts/Processes/). diff --git a/src/crewai/cli/run_crew.py b/src/crewai/cli/run_crew.py index 0b1ac29bc..829d8ed95 100644 --- a/src/crewai/cli/run_crew.py +++ b/src/crewai/cli/run_crew.py @@ -2,6 +2,9 @@ import subprocess import click import tomllib +from packaging import version + +from crewai.cli.utils import get_crewai_version def run_crew() -> None: @@ -9,6 +12,22 @@ def run_crew() -> None: Run the crew by running a command in the UV environment. """ command = ["uv", "run", "run_crew"] + crewai_version = get_crewai_version() + min_required_version = "0.71.0" + + with open("pyproject.toml", "rb") as f: + data = tomllib.load(f) + + if data.get("tool", {}).get("poetry") and ( + version.parse(crewai_version) < version.parse(min_required_version) + ): + click.secho( + f"You are running an older version of crewAI ({crewai_version}) that uses poetry pyproject.toml. " + f"Please run `crewai update` to update your pyproject.toml to use uv.", + fg="red", + ) + print() + try: subprocess.run(command, capture_output=False, text=True, check=True)