From 5bc01b15a05c5a844bd2b9d10cd4ec9dee3efafe Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Fri, 9 May 2025 02:17:48 +0000 Subject: [PATCH] Fix Python 3.13 compatibility (issue #2794) - Update Python version constraint from '>=3.10,<3.13' to '>=3.10,<3.14' in all relevant files - Add test to verify Python version compatibility - Update GitHub Actions workflow to include Python 3.13 testing - Add Docker test to verify installation on Python 3.13 Co-Authored-By: Joe Moura --- .github/workflows/tests.yml | 2 +- Dockerfile.test | 14 ++++++++++++++ pyproject.toml | 2 +- src/crewai/cli/templates/crew/pyproject.toml | 2 +- src/crewai/cli/templates/flow/pyproject.toml | 2 +- src/crewai/cli/templates/tool/pyproject.toml | 2 +- tests/cli/deploy/test_deploy_main.py | 4 ++-- tests/test_python_compatibility.py | 18 ++++++++++++++++++ uv.lock | 2 +- 9 files changed, 40 insertions(+), 8 deletions(-) create mode 100644 Dockerfile.test create mode 100644 tests/test_python_compatibility.py diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 5b53f0d12..ea69d01d0 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -14,7 +14,7 @@ jobs: timeout-minutes: 15 strategy: matrix: - python-version: ['3.10', '3.11', '3.12'] + python-version: ['3.10', '3.11', '3.12', '3.13'] steps: - name: Checkout code uses: actions/checkout@v4 diff --git a/Dockerfile.test b/Dockerfile.test new file mode 100644 index 000000000..3ad284fa3 --- /dev/null +++ b/Dockerfile.test @@ -0,0 +1,14 @@ +FROM python:3.13-slim-bookworm + +WORKDIR /app + +RUN pip install --upgrade pip + +# Copy the current directory contents into the container +COPY . /app/ + +# Install the package +RUN pip install -e . + +# Test importing the package +CMD ["python", "-c", "import crewai; print(f'Successfully imported crewai version {crewai.__version__}')"] diff --git a/pyproject.toml b/pyproject.toml index 64deb4df1..e6395fe0e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,7 +3,7 @@ name = "crewai" version = "0.119.0" description = "Cutting-edge framework for orchestrating role-playing, autonomous AI agents. By fostering collaborative intelligence, CrewAI empowers agents to work together seamlessly, tackling complex tasks." readme = "README.md" -requires-python = ">=3.10,<3.13" +requires-python = ">=3.10,<3.14" authors = [ { name = "Joao Moura", email = "joao@crewai.com" } ] diff --git a/src/crewai/cli/templates/crew/pyproject.toml b/src/crewai/cli/templates/crew/pyproject.toml index d657f1c46..b0c23a713 100644 --- a/src/crewai/cli/templates/crew/pyproject.toml +++ b/src/crewai/cli/templates/crew/pyproject.toml @@ -3,7 +3,7 @@ name = "{{folder_name}}" version = "0.1.0" description = "{{name}} using crewAI" authors = [{ name = "Your Name", email = "you@example.com" }] -requires-python = ">=3.10,<3.13" +requires-python = ">=3.10,<3.14" dependencies = [ "crewai[tools]>=0.119.0,<1.0.0" ] diff --git a/src/crewai/cli/templates/flow/pyproject.toml b/src/crewai/cli/templates/flow/pyproject.toml index 0a74a378c..8dcbdb856 100644 --- a/src/crewai/cli/templates/flow/pyproject.toml +++ b/src/crewai/cli/templates/flow/pyproject.toml @@ -3,7 +3,7 @@ name = "{{folder_name}}" version = "0.1.0" description = "{{name}} using crewAI" authors = [{ name = "Your Name", email = "you@example.com" }] -requires-python = ">=3.10,<3.13" +requires-python = ">=3.10,<3.14" dependencies = [ "crewai[tools]>=0.119.0,<1.0.0", ] diff --git a/src/crewai/cli/templates/tool/pyproject.toml b/src/crewai/cli/templates/tool/pyproject.toml index 72463bc48..2d53341f7 100644 --- a/src/crewai/cli/templates/tool/pyproject.toml +++ b/src/crewai/cli/templates/tool/pyproject.toml @@ -3,7 +3,7 @@ name = "{{folder_name}}" version = "0.1.0" description = "Power up your crews with {{folder_name}}" readme = "README.md" -requires-python = ">=3.10,<3.13" +requires-python = ">=3.10,<3.14" dependencies = [ "crewai[tools]>=0.119.0" ] diff --git a/tests/cli/deploy/test_deploy_main.py b/tests/cli/deploy/test_deploy_main.py index c9a1b884e..8a8799ca9 100644 --- a/tests/cli/deploy/test_deploy_main.py +++ b/tests/cli/deploy/test_deploy_main.py @@ -231,7 +231,7 @@ class TestDeployCommand(unittest.TestCase): [project] name = "test_project" version = "0.1.0" - requires-python = ">=3.10,<3.13" + requires-python = ">=3.10,<3.14" dependencies = ["crewai"] """, ) @@ -250,7 +250,7 @@ class TestDeployCommand(unittest.TestCase): [project] name = "test_project" version = "0.1.0" - requires-python = ">=3.10,<3.13" + requires-python = ">=3.10,<3.14" dependencies = ["crewai"] """, ) diff --git a/tests/test_python_compatibility.py b/tests/test_python_compatibility.py new file mode 100644 index 000000000..262faf26a --- /dev/null +++ b/tests/test_python_compatibility.py @@ -0,0 +1,18 @@ +"""Tests for Python version compatibility.""" +import sys +import pytest + + +def test_python_version_compatibility(): + """Test that the package supports the current Python version.""" + # This test will fail if the package doesn't support the current Python version + import crewai + + # Print the Python version for debugging + print(f"Python version: {sys.version}") + + # Print the crewai version for debugging + print(f"CrewAI version: {crewai.__version__}") + + # If we got here, the import worked, which means the package supports this Python version + assert True diff --git a/uv.lock b/uv.lock index f3cb68ceb..d91cb137f 100644 --- a/uv.lock +++ b/uv.lock @@ -1,5 +1,5 @@ version = 1 -requires-python = ">=3.10, <3.13" +requires-python = ">=3.10, <3.14" resolution-markers = [ "python_full_version < '3.11' and platform_python_implementation == 'PyPy' and platform_system == 'Darwin' and sys_platform == 'darwin'", "python_full_version < '3.11' and platform_machine == 'aarch64' and platform_python_implementation == 'PyPy' and platform_system == 'Linux' and sys_platform == 'darwin'",