mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-09 16:18:30 +00:00
Address PR review feedback and fix CI failures
Co-Authored-By: Joe Moura <joao@crewai.com>
This commit is contained in:
1
.github/workflows/tests.yml
vendored
1
.github/workflows/tests.yml
vendored
@@ -13,6 +13,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
timeout-minutes: 15
|
timeout-minutes: 15
|
||||||
strategy:
|
strategy:
|
||||||
|
fail-fast: true # Stop testing on subsequent Python versions if an earlier one fails
|
||||||
matrix:
|
matrix:
|
||||||
python-version: ['3.10', '3.11', '3.12', '3.13']
|
python-version: ['3.10', '3.11', '3.12', '3.13']
|
||||||
steps:
|
steps:
|
||||||
|
|||||||
@@ -2,13 +2,21 @@ FROM python:3.13-slim-bookworm
|
|||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
RUN pip install --upgrade pip
|
# Health check
|
||||||
|
HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 CMD python -c "import crewai" || exit 1
|
||||||
|
|
||||||
|
# Improved installation process
|
||||||
|
RUN pip install --upgrade pip && pip install --no-cache-dir -U pip setuptools wheel && rm -rf /root/.cache/pip/* \
|
||||||
|
|| { echo 'Installation failed'; exit 1; }
|
||||||
|
|
||||||
# Copy the current directory contents into the container
|
# Copy the current directory contents into the container
|
||||||
COPY . /app/
|
COPY . /app/
|
||||||
|
|
||||||
# Install the package
|
# Install the package with error handling
|
||||||
RUN pip install -e .
|
RUN pip install -e . || { echo 'Package installation failed'; exit 1; }
|
||||||
|
|
||||||
|
# Version confirmation
|
||||||
|
RUN python -c "import crewai; assert crewai.__version__, 'Version check failed'"
|
||||||
|
|
||||||
# Test importing the package
|
# Test importing the package
|
||||||
CMD ["python", "-c", "import crewai; print(f'Successfully imported crewai version {crewai.__version__}')"]
|
CMD ["python", "-c", "import crewai; print(f'Successfully imported crewai version {crewai.__version__}')"]
|
||||||
|
|||||||
@@ -1,10 +1,31 @@
|
|||||||
"""Tests for Python version compatibility."""
|
"""Tests for Python version compatibility."""
|
||||||
import pytest
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
from packaging import version
|
||||||
|
|
||||||
|
|
||||||
|
def validate_python_version():
|
||||||
|
"""Validate that the current Python version is supported."""
|
||||||
|
min_version = (3, 10)
|
||||||
|
max_version = (3, 14)
|
||||||
|
current = sys.version_info[:2]
|
||||||
|
|
||||||
|
if not (min_version <= current < max_version):
|
||||||
|
raise RuntimeError(
|
||||||
|
f"This package requires Python {min_version[0]}.{min_version[1]} to "
|
||||||
|
f"{max_version[0]}.{max_version[1]-1}. You have Python {current[0]}.{current[1]}"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def test_python_version_compatibility():
|
def test_python_version_compatibility():
|
||||||
"""Test that the package supports the current Python version."""
|
"""Test that the package supports the current Python version."""
|
||||||
|
assert isinstance(sys.version_info, tuple), "Version Information must be a tuple"
|
||||||
|
|
||||||
|
current_version = version.parse(f"{sys.version_info.major}.{sys.version_info.minor}")
|
||||||
|
assert current_version >= version.parse("3.10"), "Python version too old"
|
||||||
|
assert current_version < version.parse("3.14"), "Python version too new"
|
||||||
|
|
||||||
# This test will fail if the package doesn't support the current Python version
|
# This test will fail if the package doesn't support the current Python version
|
||||||
import crewai
|
import crewai
|
||||||
|
|
||||||
@@ -14,5 +35,5 @@ def test_python_version_compatibility():
|
|||||||
# Print the crewai version for debugging
|
# Print the crewai version for debugging
|
||||||
print(f"CrewAI version: {crewai.__version__}")
|
print(f"CrewAI version: {crewai.__version__}")
|
||||||
|
|
||||||
# If we got here, the import worked, which means the package supports this Python version
|
# Validate Python version
|
||||||
assert True
|
validate_python_version()
|
||||||
|
|||||||
Reference in New Issue
Block a user