Adapt crewai tool install <tool> to uv (#1481)

This commit updates the tool install comamnd to uv's new custom index
feature.

Related: https://github.com/astral-sh/uv/pull/7746/
This commit is contained in:
Vini Brasil
2024-10-21 09:24:03 -03:00
committed by GitHub
parent 40f81aecf5
commit b98256e434
4 changed files with 27 additions and 27 deletions

View File

@@ -28,8 +28,6 @@ class ToolCommand(BaseCommand, PlusAPIMixin):
A class to handle tool repository related operations for CrewAI projects.
"""
BASE_URL = "https://app.crewai.com/pypi/"
def __init__(self):
BaseCommand.__init__(self)
PlusAPIMixin.__init__(self, telemetry=self._telemetry)
@@ -178,12 +176,14 @@ class ToolCommand(BaseCommand, PlusAPIMixin):
def _add_package(self, tool_details):
tool_handle = tool_details["handle"]
repository_handle = tool_details["repository"]["handle"]
repository_url = tool_details["repository"]["url"]
index = f"{repository_handle}={repository_url}"
add_package_command = [
"uv",
"add",
"--extra-index-url",
self.BASE_URL + repository_handle,
"--index",
index,
tool_handle,
]
add_package_result = subprocess.run(