mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-06 08:16:43 +00:00
105 lines
3.5 KiB
YAML
105 lines
3.5 KiB
YAML
name: Python Compatibility
|
|
|
|
on:
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
- litellm_internal_staging
|
|
- litellm_oss_staging
|
|
- "litellm_**"
|
|
push:
|
|
branches:
|
|
- main
|
|
- litellm_internal_staging
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
|
|
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
|
|
|
jobs:
|
|
compatibility:
|
|
name: Python ${{ matrix.python-version }}
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 45
|
|
permissions:
|
|
contents: read
|
|
pull-requests: read
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
|
|
env:
|
|
UV_PYTHON: ${{ matrix.python-version }}
|
|
LITELLM_LOCAL_MODEL_COST_MAP: "True"
|
|
|
|
steps:
|
|
- uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
|
|
timeout-minutes: 3
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- name: Detect relevant changes
|
|
id: changes
|
|
timeout-minutes: 2
|
|
uses: ./.github/actions/detect-changes
|
|
|
|
- name: Set up Python
|
|
if: steps.changes.outputs.decision != 'skip'
|
|
timeout-minutes: 3
|
|
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
|
|
with:
|
|
python-version: ${{ matrix.python-version }}
|
|
|
|
- name: Set up uv
|
|
if: steps.changes.outputs.decision != 'skip'
|
|
timeout-minutes: 3
|
|
uses: ./.github/actions/setup-uv-with-retries
|
|
with:
|
|
version: "0.10.9"
|
|
|
|
- name: Cache uv dependencies
|
|
if: steps.changes.outputs.decision != 'skip'
|
|
timeout-minutes: 5
|
|
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
|
|
with:
|
|
path: ~/.cache/uv
|
|
key: ${{ runner.os }}-uv-compat-py${{ matrix.python-version }}-${{ hashFiles('uv.lock') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-uv-compat-py${{ matrix.python-version }}-
|
|
|
|
- name: Cache the Rust build
|
|
if: steps.changes.outputs.decision != 'skip'
|
|
timeout-minutes: 5
|
|
uses: ./.github/actions/cache-cargo-build
|
|
|
|
- name: Install SDK and proxy dependencies
|
|
id: install
|
|
if: steps.changes.outputs.decision != 'skip'
|
|
timeout-minutes: 8
|
|
run: |
|
|
.github/scripts/uv_sync_with_retries.sh --frozen --no-dev --extra proxy
|
|
uv run --no-sync python -c 'import os, sys; print(sys.version); assert f"{sys.version_info.major}.{sys.version_info.minor}" == os.environ["UV_PYTHON"]'
|
|
|
|
- name: Compile package
|
|
if: ${{ !cancelled() && steps.install.outcome == 'success' }}
|
|
timeout-minutes: 2
|
|
run: uv run --no-sync python -m compileall -q litellm
|
|
|
|
- name: Import SDK
|
|
if: ${{ !cancelled() && steps.install.outcome == 'success' }}
|
|
timeout-minutes: 2
|
|
run: uv run --no-sync python -c 'from litellm import *; print("SDK import passed")'
|
|
|
|
- name: Import proxy
|
|
if: ${{ !cancelled() && steps.install.outcome == 'success' }}
|
|
timeout-minutes: 2
|
|
run: uv run --no-sync python -c 'import litellm.proxy.proxy_server; print("Proxy import passed")'
|
|
|
|
- name: Construct a completion response
|
|
if: ${{ !cancelled() && steps.install.outcome == 'success' }}
|
|
timeout-minutes: 2
|
|
run: uv run --no-sync python -c 'from litellm.types.utils import ModelResponse; ModelResponse(); print("Response construction passed")'
|