From b799cae52f704f75b33c355ecb22b88ba4d78c22 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Thu, 20 Mar 2025 07:18:24 +0000 Subject: [PATCH] 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 --- pyproject.toml | 2 +- tests/cli/test_click_compatibility.py | 48 +++++++++++++++++++++++++++ 2 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 tests/cli/test_click_compatibility.py diff --git a/pyproject.toml b/pyproject.toml index 2e319e8d0..4a924eb1f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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", diff --git a/tests/cli/test_click_compatibility.py b/tests/cli/test_click_compatibility.py new file mode 100644 index 000000000..fbdfe8b04 --- /dev/null +++ b/tests/cli/test_click_compatibility.py @@ -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