Fix click dependency constraint to be compatible with zenml

The current dependency constraint for Click (>=8.1.7) is incompatible
with zenml[server] which requires (>=8.0.1,<8.1.4). This change
relaxes crewAI's Click constraint to allow for compatibility with
zenml while maintaining functionality.

Fixes #2415

Co-Authored-By: Joe Moura <joao@crewai.com>
This commit is contained in:
Devin AI
2025-03-20 07:18:24 +00:00
parent fe0813e831
commit b799cae52f
2 changed files with 49 additions and 1 deletions

View File

@@ -28,7 +28,7 @@ dependencies = [
"auth0-python>=4.7.1",
"python-dotenv>=1.0.0",
# Configuration and Utils
"click>=8.1.7",
"click>=8.0.1",
"appdirs>=1.4.4",
"jsonref>=1.1.0",
"json-repair>=0.25.2",

View File

@@ -0,0 +1,48 @@
import subprocess
import sys
import tempfile
import pytest
def test_crewai_cli_works_with_compatible_click_version():
"""Test that crewAI CLI works with Click version compatible with zenml."""
# Create a temporary virtual environment
with tempfile.TemporaryDirectory() as temp_dir:
# Create a new virtual environment
subprocess.run(
[sys.executable, "-m", "venv", f"{temp_dir}/venv"],
check=True,
)
# Install Click 8.1.3 (compatible with zenml's constraints)
subprocess.run(
[f"{temp_dir}/venv/bin/pip", "install", "click==8.1.3"],
check=True,
)
# Install crewai in development mode
subprocess.run(
[f"{temp_dir}/venv/bin/pip", "install", "-e", "."],
check=True,
)
# Verify that the crewai CLI can be imported and run
result = subprocess.run(
[f"{temp_dir}/venv/bin/python", "-c", "from crewai.cli.cli import crewai; print('CLI import successful')"],
capture_output=True,
text=True,
)
assert result.returncode == 0
assert "CLI import successful" in result.stdout
# Test running a basic CLI command
result = subprocess.run(
[f"{temp_dir}/venv/bin/python", "-m", "crewai.cli.cli", "version"],
capture_output=True,
text=True,
)
assert result.returncode == 0
assert "crewai version" in result.stdout