name: "Unit Tests: Redis Client Version Compatibility" on: pull_request: branches: - main - litellm_internal_staging - litellm_oss_staging - "litellm_**" paths: - "litellm/_redis.py" - "litellm/_redis_credential_provider.py" - "tests/test_litellm/test_redis.py" - "tests/test_litellm/caching/test_redis_connection_pool.py" - ".github/workflows/test-redis-compat.yml" - "pyproject.toml" - "uv.lock" permissions: contents: read concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true jobs: redis-compat: name: "redis-py ${{ matrix.redis-version }}" runs-on: ubuntu-latest timeout-minutes: 15 strategy: fail-fast: false matrix: # 5.3.1 is the version pinned in uv.lock (redisvl caps it below 6); the # newer legs prove the inspect.signature introspection in litellm/_redis.py # keeps extracting kwargs on the redis-py releases people actually run now. # Only the exact release 6.0.0 is skipped: rq (pulled by the proxy extra) # specifies `redis != 6`, which excludes 6.0.0 alone, so 6.4.0 stands in # for the 6.x line. redis-version: ["5.3.1", "6.4.0", "7.4.1", "8.0.1"] steps: - uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0 with: persist-credentials: false - name: Set up Python uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 with: python-version: "3.12" - name: Set up uv uses: ./.github/actions/setup-uv-with-retries with: version: "0.10.9" - name: Install dependencies run: | .github/scripts/uv_sync_with_retries.sh --frozen --group ci --group proxy-dev --extra google --extra proxy --extra semantic-router - name: Pin redis-py to the matrix version env: REDIS_VERSION: ${{ matrix.redis-version }} run: | uv pip install "redis==${REDIS_VERSION:?}" uv run --no-sync python -c "import redis; assert redis.__version__ == '${REDIS_VERSION:?}', redis.__version__; print('redis-py', redis.__version__)" - name: Run redis unit tests run: | uv run --no-sync pytest \ tests/test_litellm/test_redis.py \ tests/test_litellm/caching/test_redis_connection_pool.py \ --tb=short -vv \ --reruns 2 \ --reruns-delay 1 \ --durations=20