diff --git a/.circleci/config.yml b/.circleci/config.yml index 5bbabad9107..e098e65bd23 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -20,36 +20,27 @@ commands: steps: - run: name: "Install local version of litellm-enterprise" - command: | - pip install --force-reinstall --no-deps -e enterprise/ + command: true setup_litellm_test_deps: steps: - checkout - setup_google_dns - restore_cache: keys: - - v3-litellm-uv-deps-{{ checksum "requirements.txt" }}-{{ checksum ".circleci/config.yml" }} + - v3-litellm-uv-deps-{{ checksum "uv.lock" }}-{{ checksum ".circleci/config.yml" }} - run: name: Install Dependencies command: | - python -m pip install --upgrade pip uv - # Use uv for the heavy requirements.txt (10-100x faster than pip) - uv pip install --system -r requirements.txt - # Use pip for test deps (small set, avoids uv strict-resolution - # conflicts with transitive dep pins like openai<2 and pydantic>=2.11.5) - pip install "pytest-mock==3.12.0" "pytest==7.3.1" "pytest-retry==1.6.3" \ - "pytest-asyncio==0.21.1" "respx==0.22.0" "hypercorn==0.17.3" \ - "pydantic==2.12.5" "mcp==1.26.0" "requests-mock>=1.12.1" \ - "responses==0.25.7" "pytest-xdist==3.6.1" "pytest-timeout==2.2.0" \ - "pytest-cov==5.0.0" "semantic_router==0.1.10" "fastapi-offline==1.7.3" \ - "a2a" "parameterized>=0.9.0" + curl -LsSf https://astral.sh/uv/0.10.9/install.sh | env UV_NO_MODIFY_PATH=1 sh + export PATH="$HOME/.local/bin:$PATH" + uv sync --frozen --all-groups --all-extras --python "$(which python)" - setup_litellm_enterprise_pip - save_cache: paths: - ~/.local/lib - ~/.local/bin - ~/.cache/uv - key: v3-litellm-uv-deps-{{ checksum "requirements.txt" }}-{{ checksum ".circleci/config.yml" }} + key: v3-litellm-uv-deps-{{ checksum "uv.lock" }}-{{ checksum ".circleci/config.yml" }} jobs: # Add Windows testing job @@ -71,13 +62,13 @@ jobs: - run: name: Install Dependencies command: | - python -m pip install --upgrade pip - pip install pytest - pip install . + Invoke-RestMethod https://astral.sh/uv/0.10.9/install.ps1 | Invoke-Expression + $env:Path = "$HOME\.local\bin;$env:Path" + uv sync --frozen --group dev --python (Get-Command python).Source - run: name: Run Windows-specific test command: | - python -m pytest tests/windows_tests/test_litellm_on_windows.py -v + uv run --no-sync python -m pytest tests/windows_tests/test_litellm_on_windows.py -v mypy_linting: docker: @@ -94,16 +85,15 @@ jobs: - run: name: Install Dependencies command: | - python -m pip install --upgrade pip uv - uv pip install --system -r requirements.txt - pip uninstall fastuuid -y - pip install "mypy==1.18.2" + curl -LsSf https://astral.sh/uv/0.10.9/install.sh | env UV_NO_MODIFY_PATH=1 sh + export PATH="$HOME/.local/bin:$PATH" + uv sync --frozen --group dev --python "$(which python)" --no-install-package fastuuid - run: name: MyPy Type Checking command: | cd litellm # Use the same approach as GitHub Actions, explicitly exclude fastuuid to avoid segfaults - python -m mypy . + uv run --no-sync python -m mypy . cd .. no_output_timeout: 10m @@ -120,10 +110,14 @@ jobs: - setup_google_dns - run: name: Install Semgrep - command: pip install semgrep + command: | + curl -LsSf https://astral.sh/uv/0.10.9/install.sh | env UV_NO_MODIFY_PATH=1 sh + export PATH="$HOME/.local/bin:$PATH" - run: name: Run Semgrep (custom rules only) - command: semgrep scan --config .semgrep/rules . --error + command: | + export PATH="$HOME/.local/bin:$PATH" + uv tool run --from semgrep semgrep scan --config .semgrep/rules . --error local_testing_part1: docker: @@ -143,31 +137,23 @@ jobs: - restore_cache: keys: - - v1-dependencies-{{ checksum ".circleci/requirements.txt" }} + - v1-dependencies-{{ checksum "uv.lock" }} - run: name: Install Dependencies command: | - python -m pip install --upgrade pip - python -m pip install -r .circleci/requirements.txt - pip install "pytest==7.3.1" "pytest-retry==1.6.3" "pytest-asyncio==0.21.1" "pytest-cov==5.0.0" \ - "mypy==1.18.2" "google-generativeai==0.3.2" "google-cloud-aiplatform==1.133.0" pyarrow \ - "boto3==1.42.80" langchain lunary==0.2.5 \ - "azure-identity==1.25.3" "langfuse==2.59.7" "logfire==0.29.0" numpydoc \ - traceloop-sdk==0.21.1 openai==1.100.1 prisma==0.11.0 \ - "detect_secrets==1.5.0" "respx==0.22.0" fastapi \ - "gunicorn==23.0.0" "aiodynamo==23.10.1" "asyncio==3.4.3" \ - "apscheduler==3.11.2" "PyGithub==1.59.1" argon2-cffi "pytest-mock==3.12.0" \ - python-multipart prometheus-client==0.20.0 "pydantic==2.12.5" \ - "diskcache==5.6.1" "Pillow==12.1.1" "jsonschema==4.23.0" \ - "pytest-xdist==3.6.1" "pytest-timeout==2.2.0" "websockets==15.0.1" - pip install semantic_router --no-deps - pip install aurelio_sdk --no-deps - pip uninstall posthog -y + curl -LsSf https://astral.sh/uv/0.10.9/install.sh | env UV_NO_MODIFY_PATH=1 sh + export PATH="$HOME/.local/bin:$PATH" + if [ -f "$HOME/miniconda/etc/profile.d/conda.sh" ]; then + export PATH="$HOME/miniconda/bin:$PATH" + source "$HOME/miniconda/etc/profile.d/conda.sh" + conda activate myenv + fi + uv sync --frozen --all-groups --all-extras --python "$(which python)" - setup_litellm_enterprise_pip - save_cache: paths: - - ./venv - key: v1-dependencies-{{ checksum ".circleci/requirements.txt" }} + - ./.venv + key: v1-dependencies-{{ checksum "uv.lock" }} - run: name: Run prisma ./docker/entrypoint.sh command: | @@ -179,8 +165,7 @@ jobs: name: Black Formatting command: | cd litellm - python -m pip install black - python -m black . + uv run --no-sync python -m black . cd .. # Run pytest and generate JUnit XML report @@ -195,7 +180,7 @@ jobs: echo "$TEST_FILES" | circleci tests run \ --split-by=timings \ --verbose \ - --command="xargs python -m pytest \ + --command="xargs uv run --no-sync python -m pytest \ -vv \ --cov=litellm \ --cov-report=xml \ @@ -238,31 +223,23 @@ jobs: - restore_cache: keys: - - v1-dependencies-{{ checksum ".circleci/requirements.txt" }} + - v1-dependencies-{{ checksum "uv.lock" }} - run: name: Install Dependencies command: | - python -m pip install --upgrade pip - python -m pip install -r .circleci/requirements.txt - pip install "pytest==7.3.1" "pytest-retry==1.6.3" "pytest-asyncio==0.21.1" "pytest-cov==5.0.0" \ - "mypy==1.18.2" "google-generativeai==0.3.2" "google-cloud-aiplatform==1.133.0" pyarrow \ - "boto3==1.42.80" langchain lunary==0.2.5 \ - "azure-identity==1.25.3" "langfuse==2.59.7" "logfire==0.29.0" numpydoc \ - traceloop-sdk==0.21.1 openai==1.100.1 prisma==0.11.0 \ - "detect_secrets==1.5.0" "respx==0.22.0" fastapi \ - "gunicorn==23.0.0" "aiodynamo==23.10.1" "asyncio==3.4.3" \ - "apscheduler==3.11.2" "PyGithub==1.59.1" argon2-cffi "pytest-mock==3.12.0" \ - python-multipart prometheus-client==0.20.0 "pydantic==2.12.5" \ - "diskcache==5.6.1" "Pillow==12.1.1" "jsonschema==4.23.0" \ - "pytest-xdist==3.6.1" "pytest-timeout==2.2.0" "websockets==15.0.1" - pip install semantic_router --no-deps - pip install aurelio_sdk --no-deps - pip uninstall posthog -y + curl -LsSf https://astral.sh/uv/0.10.9/install.sh | env UV_NO_MODIFY_PATH=1 sh + export PATH="$HOME/.local/bin:$PATH" + if [ -f "$HOME/miniconda/etc/profile.d/conda.sh" ]; then + export PATH="$HOME/miniconda/bin:$PATH" + source "$HOME/miniconda/etc/profile.d/conda.sh" + conda activate myenv + fi + uv sync --frozen --all-groups --all-extras --python "$(which python)" - setup_litellm_enterprise_pip - save_cache: paths: - - ./venv - key: v1-dependencies-{{ checksum ".circleci/requirements.txt" }} + - ./.venv + key: v1-dependencies-{{ checksum "uv.lock" }} - run: name: Run prisma ./docker/entrypoint.sh command: | @@ -274,8 +251,7 @@ jobs: name: Black Formatting command: | cd litellm - python -m pip install black - python -m black . + uv run --no-sync python -m black . cd .. # Run pytest and generate JUnit XML report @@ -290,7 +266,7 @@ jobs: echo "$TEST_FILES" | circleci tests run \ --split-by=timings \ --verbose \ - --command="xargs python -m pytest \ + --command="xargs uv run --no-sync python -m pytest \ -vv \ --cov=litellm \ --cov-report=xml \ @@ -334,58 +310,23 @@ jobs: - restore_cache: keys: - - v1-dependencies-{{ checksum ".circleci/requirements.txt" }} + - v1-dependencies-{{ checksum "uv.lock" }} - run: name: Install Dependencies command: | - python -m pip install --upgrade pip - python -m pip install -r .circleci/requirements.txt - pip install "pytest==7.3.1" - pip install "pytest-retry==1.6.3" - pip install "pytest-asyncio==0.21.1" - pip install "pytest-cov==5.0.0" - pip install "mypy==1.18.2" - pip install "google-generativeai==0.3.2" - pip install "google-cloud-aiplatform==1.133.0" - pip install pyarrow - pip install "boto3==1.42.80" - pip install langchain - pip install lunary==0.2.5 - pip install "azure-identity==1.25.3" - pip install "langfuse==2.59.7" - pip install "logfire==0.29.0" - pip install numpydoc - pip install traceloop-sdk==0.21.1 - pip install opentelemetry-api==1.28.0 - pip install opentelemetry-sdk==1.28.0 - pip install opentelemetry-exporter-otlp==1.28.0 - pip install openai==1.100.1 - pip install prisma==0.11.0 - pip install "detect_secrets==1.5.0" - pip install "httpx==0.28.1" - pip install "respx==0.22.0" - pip install fastapi - pip install "gunicorn==23.0.0" - pip install "anyio==4.8.0" - pip install "aiodynamo==23.10.1" - pip install "asyncio==3.4.3" - pip install "apscheduler==3.11.2" - pip install "PyGithub==1.59.1" - pip install argon2-cffi - pip install "pytest-mock==3.12.0" - pip install python-multipart - pip install google-cloud-aiplatform - pip install prometheus-client==0.20.0 - pip install "pydantic==2.12.5" - pip install "diskcache==5.6.1" - pip install "Pillow==12.1.1" - pip install "jsonschema==4.23.0" - pip install "websockets==15.0.1" + curl -LsSf https://astral.sh/uv/0.10.9/install.sh | env UV_NO_MODIFY_PATH=1 sh + export PATH="$HOME/.local/bin:$PATH" + if [ -f "$HOME/miniconda/etc/profile.d/conda.sh" ]; then + export PATH="$HOME/miniconda/bin:$PATH" + source "$HOME/miniconda/etc/profile.d/conda.sh" + conda activate myenv + fi + uv sync --frozen --all-groups --all-extras --python "$(which python)" - setup_litellm_enterprise_pip - save_cache: paths: - - ./venv - key: v1-dependencies-{{ checksum ".circleci/requirements.txt" }} + - ./.venv + key: v1-dependencies-{{ checksum "uv.lock" }} - run: name: Run prisma ./docker/entrypoint.sh command: | @@ -400,7 +341,7 @@ jobs: command: | pwd ls - python -m pytest -v tests/local_testing -x --junitxml=test-results/junit.xml --durations=5 -k "langfuse" + uv run --no-sync python -m pytest -v tests/local_testing -x --junitxml=test-results/junit.xml --durations=5 -k "langfuse" no_output_timeout: 15m # Store test results - store_test_results: @@ -419,16 +360,18 @@ jobs: - run: name: Install Dependencies command: | - python -m pip install --upgrade pip uv - uv pip install --system -r requirements.txt - pip install "pytest==7.3.1" - pip install "pytest-retry==1.6.3" - pip install "pytest-asyncio==0.21.1" - pip install "pytest-xdist==3.6.1" + curl -LsSf https://astral.sh/uv/0.10.9/install.sh | env UV_NO_MODIFY_PATH=1 sh + export PATH="$HOME/.local/bin:$PATH" + if [ -f "$HOME/miniconda/etc/profile.d/conda.sh" ]; then + export PATH="$HOME/miniconda/bin:$PATH" + source "$HOME/miniconda/etc/profile.d/conda.sh" + conda activate myenv + fi + uv sync --frozen --all-groups --all-extras --python "$(which python)" - save_cache: paths: - - ./venv - key: v1-dependencies-{{ checksum ".circleci/requirements.txt" }} + - ./.venv + key: v1-dependencies-{{ checksum "uv.lock" }} - run: name: Run prisma ./docker/entrypoint.sh command: | @@ -442,7 +385,7 @@ jobs: command: | pwd ls - python -m pytest -v tests/proxy_admin_ui_tests -x --junitxml=test-results/junit.xml --durations=5 -n 2 + uv run --no-sync python -m pytest -v tests/proxy_admin_ui_tests -x --junitxml=test-results/junit.xml --durations=5 -n 2 no_output_timeout: 15m # Store test results @@ -463,25 +406,23 @@ jobs: - setup_google_dns - restore_cache: keys: - - v1-router-testing-deps-{{ checksum "requirements.txt" }} + - v1-router-testing-deps-{{ checksum "uv.lock" }} - run: name: Install Dependencies command: | - python -m pip install --upgrade pip uv - uv pip install --system -r requirements.txt - pip install "pytest==7.3.1" - pip install "respx==0.22.0" - pip install "pytest-retry==1.6.3" - pip install "pytest-asyncio==0.21.1" - pip install "pytest-xdist==3.6.1" - pip install "pytest-timeout==2.2.0" - pip install semantic_router --no-deps - pip install aurelio_sdk --no-deps + curl -LsSf https://astral.sh/uv/0.10.9/install.sh | env UV_NO_MODIFY_PATH=1 sh + export PATH="$HOME/.local/bin:$PATH" + if [ -f "$HOME/miniconda/etc/profile.d/conda.sh" ]; then + export PATH="$HOME/miniconda/bin:$PATH" + source "$HOME/miniconda/etc/profile.d/conda.sh" + conda activate myenv + fi + uv sync --frozen --all-groups --all-extras --python "$(which python)" - save_cache: paths: - /home/circleci/.pyenv - /home/circleci/.local - key: v1-router-testing-deps-{{ checksum "requirements.txt" }} + key: v1-router-testing-deps-{{ checksum "uv.lock" }} # Run pytest and generate JUnit XML report - setup_litellm_enterprise_pip - run: @@ -494,7 +435,7 @@ jobs: echo "$TEST_FILES" | circleci tests run \ --split-by=timings \ --verbose \ - --command="xargs python -m pytest \ + --command="xargs uv run --no-sync python -m pytest \ -v \ -k 'router' \ -n 4 \ @@ -520,24 +461,23 @@ jobs: - setup_google_dns - restore_cache: keys: - - v1-router-unit-deps-{{ checksum "requirements.txt" }} + - v1-router-unit-deps-{{ checksum "uv.lock" }} - run: name: Install Dependencies command: | - python -m pip install --upgrade pip uv - uv pip install --system -r requirements.txt - pip install "pytest==7.3.1" - pip install "respx==0.22.0" - pip install "pytest-retry==1.6.3" - pip install "pytest-asyncio==0.21.1" - pip install semantic_router --no-deps - pip install aurelio_sdk --no-deps - pip install "pytest-xdist==3.6.1" + curl -LsSf https://astral.sh/uv/0.10.9/install.sh | env UV_NO_MODIFY_PATH=1 sh + export PATH="$HOME/.local/bin:$PATH" + if [ -f "$HOME/miniconda/etc/profile.d/conda.sh" ]; then + export PATH="$HOME/miniconda/bin:$PATH" + source "$HOME/miniconda/etc/profile.d/conda.sh" + conda activate myenv + fi + uv sync --frozen --all-groups --all-extras --python "$(which python)" - save_cache: paths: - /home/circleci/.pyenv - /home/circleci/.local - key: v1-router-unit-deps-{{ checksum "requirements.txt" }} + key: v1-router-unit-deps-{{ checksum "uv.lock" }} # Run pytest and generate JUnit XML report - setup_litellm_enterprise_pip - run: @@ -545,7 +485,7 @@ jobs: command: | pwd ls - python -m pytest -v tests/router_unit_tests -x --junitxml=test-results/junit.xml --durations=5 -n 4 + uv run --no-sync python -m pytest -v tests/router_unit_tests -x --junitxml=test-results/junit.xml --durations=5 -n 4 no_output_timeout: 15m # Store test results - store_test_results: @@ -565,13 +505,14 @@ jobs: - run: name: Install Dependencies command: | - python -m pip install --upgrade pip uv - pip install wheel setuptools - uv pip install --system -r requirements.txt - pip install "pytest==7.3.1" - pip install "respx==0.22.0" - pip install "pytest-retry==1.6.3" - pip install "pytest-asyncio==0.21.1" + curl -LsSf https://astral.sh/uv/0.10.9/install.sh | env UV_NO_MODIFY_PATH=1 sh + export PATH="$HOME/.local/bin:$PATH" + if [ -f "$HOME/miniconda/etc/profile.d/conda.sh" ]; then + export PATH="$HOME/miniconda/bin:$PATH" + source "$HOME/miniconda/etc/profile.d/conda.sh" + conda activate myenv + fi + uv sync --frozen --all-groups --all-extras --python "$(which python)" # Run pytest and generate JUnit XML report - setup_litellm_enterprise_pip - run: @@ -579,7 +520,7 @@ jobs: command: | pwd ls - python -m pytest tests/local_testing/ -v -k "assistants" -x --junitxml=test-results/junit.xml --durations=5 + uv run --no-sync python -m pytest tests/local_testing/ -v -k "assistants" -x --junitxml=test-results/junit.xml --durations=5 no_output_timeout: 15m # Store test results - store_test_results: @@ -598,23 +539,23 @@ jobs: - setup_google_dns - restore_cache: keys: - - v1-llm-translation-deps-{{ checksum "requirements.txt" }} + - v1-llm-translation-deps-{{ checksum "uv.lock" }} - run: name: Install Dependencies command: | - python -m pip install --upgrade pip uv - uv pip install --system -r requirements.txt - pip install "pytest==7.3.1" - pip install "pytest-retry==1.6.3" - pip install "pytest-asyncio==0.21.1" - pip install "respx==0.22.0" - pip install "pytest-xdist==3.6.1" - pip install "pytest-timeout==2.2.0" + curl -LsSf https://astral.sh/uv/0.10.9/install.sh | env UV_NO_MODIFY_PATH=1 sh + export PATH="$HOME/.local/bin:$PATH" + if [ -f "$HOME/miniconda/etc/profile.d/conda.sh" ]; then + export PATH="$HOME/miniconda/bin:$PATH" + source "$HOME/miniconda/etc/profile.d/conda.sh" + conda activate myenv + fi + uv sync --frozen --all-groups --all-extras --python "$(which python)" - save_cache: paths: - /home/circleci/.pyenv - /home/circleci/.local - key: v1-llm-translation-deps-{{ checksum "requirements.txt" }} + key: v1-llm-translation-deps-{{ checksum "uv.lock" }} # Run pytest and generate JUnit XML report - run: name: Run tests @@ -631,7 +572,7 @@ jobs: for dir in "${IGNORE_DIRS[@]}"; do IGNORE_ARGS="$IGNORE_ARGS --ignore=$dir" done - python -m pytest -v tests/llm_translation $IGNORE_ARGS --junitxml=test-results/junit.xml --durations=20 -n 8 --timeout=120 --timeout_method=thread --retries 2 --retry-delay 5 + uv run --no-sync python -m pytest -v tests/llm_translation $IGNORE_ARGS --junitxml=test-results/junit.xml --durations=20 -n 8 --timeout=120 --timeout_method=thread --retries 2 --retry-delay 5 no_output_timeout: 15m # Store test results @@ -651,9 +592,14 @@ jobs: - run: name: Install Dependencies command: | - python -m pip install --upgrade pip uv - uv pip install --system -r requirements.txt - pip install "pytest==7.3.1" "pytest-retry==1.6.3" "pytest-cov==5.0.0" "pytest-asyncio==0.21.1" "respx==0.22.0" "pytest-xdist==3.6.1" "pytest-timeout==2.2.0" "websockets" + curl -LsSf https://astral.sh/uv/0.10.9/install.sh | env UV_NO_MODIFY_PATH=1 sh + export PATH="$HOME/.local/bin:$PATH" + if [ -f "$HOME/miniconda/etc/profile.d/conda.sh" ]; then + export PATH="$HOME/miniconda/bin:$PATH" + source "$HOME/miniconda/etc/profile.d/conda.sh" + conda activate myenv + fi + uv sync --frozen --all-groups --all-extras --python "$(which python)" # Run pytest and generate JUnit XML report - run: name: Run realtime tests @@ -662,7 +608,7 @@ jobs: ls # Add --timeout to kill hanging tests after 120s (2 min) # Add --durations=20 to show 20 slowest tests for debugging - python -m pytest -vv tests/llm_translation/realtime --cov=litellm --cov-report=xml -v --junitxml=test-results/junit.xml --durations=20 -n 4 --timeout=120 --timeout_method=thread + uv run --no-sync python -m pytest -vv tests/llm_translation/realtime --cov=litellm --cov-report=xml -v --junitxml=test-results/junit.xml --durations=20 -n 4 --timeout=120 --timeout_method=thread no_output_timeout: 15m - run: name: Rename the coverage files @@ -692,23 +638,21 @@ jobs: - run: name: Install Dependencies command: | - python -m pip install --upgrade pip uv - uv pip install --system -r requirements.txt - pip install "pytest==7.3.1" - pip install "pytest-retry==1.6.3" - pip install "pytest-cov==5.0.0" - pip install "pytest-asyncio==0.21.1" - pip install "respx==0.22.0" - pip install "pydantic==2.12.5" - pip install "mcp==1.26.0" - pip install "pytest-xdist==3.6.1" + curl -LsSf https://astral.sh/uv/0.10.9/install.sh | env UV_NO_MODIFY_PATH=1 sh + export PATH="$HOME/.local/bin:$PATH" + if [ -f "$HOME/miniconda/etc/profile.d/conda.sh" ]; then + export PATH="$HOME/miniconda/bin:$PATH" + source "$HOME/miniconda/etc/profile.d/conda.sh" + conda activate myenv + fi + uv sync --frozen --all-groups --all-extras --python "$(which python)" # Run pytest and generate JUnit XML report - run: name: Run tests command: | pwd ls - python -m pytest -vv tests/mcp_tests --cov=litellm --cov-report=xml -x -s -v --junitxml=test-results/junit.xml --durations=5 -n 2 + uv run --no-sync python -m pytest -vv tests/mcp_tests --cov=litellm --cov-report=xml -x -s -v --junitxml=test-results/junit.xml --durations=5 -n 2 no_output_timeout: 15m - run: name: Rename the coverage files @@ -738,22 +682,21 @@ jobs: - run: name: Install Dependencies command: | - python -m pip install --upgrade pip uv - uv pip install --system -r requirements.txt - pip install "pytest==7.3.1" - pip install "pytest-retry==1.6.3" - pip install "pytest-cov==5.0.0" - pip install "pytest-asyncio==0.21.1" - pip install "respx==0.22.0" - pip install "pydantic==2.12.5" - pip install "a2a-sdk" + curl -LsSf https://astral.sh/uv/0.10.9/install.sh | env UV_NO_MODIFY_PATH=1 sh + export PATH="$HOME/.local/bin:$PATH" + if [ -f "$HOME/miniconda/etc/profile.d/conda.sh" ]; then + export PATH="$HOME/miniconda/bin:$PATH" + source "$HOME/miniconda/etc/profile.d/conda.sh" + conda activate myenv + fi + uv sync --frozen --all-groups --all-extras --python "$(which python)" # Run pytest and generate JUnit XML report - run: name: Run tests command: | pwd ls - python -m pytest -vv tests/agent_tests --ignore=tests/agent_tests/local_only_agent_tests --cov=litellm --cov-report=xml -x -s -v --junitxml=test-results/junit.xml --durations=5 + uv run --no-sync python -m pytest -vv tests/agent_tests --ignore=tests/agent_tests/local_only_agent_tests --cov=litellm --cov-report=xml -x -s -v --junitxml=test-results/junit.xml --durations=5 no_output_timeout: 15m - run: name: Rename the coverage files @@ -783,26 +726,21 @@ jobs: - run: name: Install Dependencies command: | - python -m pip install --upgrade pip uv - uv pip install --system -r requirements.txt - pip install "pytest==7.3.1" - pip install "pytest-retry==1.6.3" - pip install "pytest-cov==5.0.0" - pip install "pytest-asyncio==0.21.1" - pip install "respx==0.22.0" - pip install "pydantic==2.12.5" - pip install "boto3==1.42.80" - pip install "semantic_router==0.1.10" --no-deps - pip install aurelio_sdk - pip install "pytest-xdist==3.6.1" - pip install "pytest-timeout==2.2.0" + curl -LsSf https://astral.sh/uv/0.10.9/install.sh | env UV_NO_MODIFY_PATH=1 sh + export PATH="$HOME/.local/bin:$PATH" + if [ -f "$HOME/miniconda/etc/profile.d/conda.sh" ]; then + export PATH="$HOME/miniconda/bin:$PATH" + source "$HOME/miniconda/etc/profile.d/conda.sh" + conda activate myenv + fi + uv sync --frozen --all-groups --all-extras --python "$(which python)" # Run pytest and generate JUnit XML report - run: name: Run tests command: | pwd ls - LITELLM_LOG=WARNING python -m pytest tests/guardrails_tests -vv --cov=litellm --cov-report=xml --junitxml=test-results/junit.xml --durations=5 -n 2 --timeout=120 --timeout_method=thread + LITELLM_LOG=WARNING uv run --no-sync python -m pytest tests/guardrails_tests -vv --cov=litellm --cov-report=xml --junitxml=test-results/junit.xml --durations=5 -n 2 --timeout=120 --timeout_method=thread no_output_timeout: 15m - run: name: Rename the coverage files @@ -833,21 +771,21 @@ jobs: - run: name: Install Dependencies command: | - python -m pip install --upgrade pip uv - uv pip install --system -r requirements.txt - pip install "pytest==7.3.1" - pip install "pytest-retry==1.6.3" - pip install "pytest-cov==5.0.0" - pip install "pytest-asyncio==0.21.1" - pip install "respx==0.22.0" - pip install "pydantic==2.12.5" + curl -LsSf https://astral.sh/uv/0.10.9/install.sh | env UV_NO_MODIFY_PATH=1 sh + export PATH="$HOME/.local/bin:$PATH" + if [ -f "$HOME/miniconda/etc/profile.d/conda.sh" ]; then + export PATH="$HOME/miniconda/bin:$PATH" + source "$HOME/miniconda/etc/profile.d/conda.sh" + conda activate myenv + fi + uv sync --frozen --all-groups --all-extras --python "$(which python)" # Run pytest and generate JUnit XML report - run: name: Run tests command: | pwd ls - python -m pytest -vv tests/unified_google_tests --cov=litellm --cov-report=xml -x -s -v --junitxml=test-results/junit.xml --durations=5 --retries 3 --retry-delay 5 + uv run --no-sync python -m pytest -vv tests/unified_google_tests --cov=litellm --cov-report=xml -x -s -v --junitxml=test-results/junit.xml --durations=5 --retries 3 --retry-delay 5 no_output_timeout: 15m - run: name: Rename the coverage files @@ -878,29 +816,30 @@ jobs: - setup_google_dns - restore_cache: keys: - - v1-llm-responses-deps-{{ checksum "requirements.txt" }} + - v1-llm-responses-deps-{{ checksum "uv.lock" }} - run: name: Install Dependencies command: | - python -m pip install --upgrade pip uv - uv pip install --system -r requirements.txt - pip install "pytest==7.3.1" - pip install "pytest-retry==1.6.3" - pip install "pytest-asyncio==0.21.1" - pip install "respx==0.22.0" - pip install "pytest-xdist==3.6.1" + curl -LsSf https://astral.sh/uv/0.10.9/install.sh | env UV_NO_MODIFY_PATH=1 sh + export PATH="$HOME/.local/bin:$PATH" + if [ -f "$HOME/miniconda/etc/profile.d/conda.sh" ]; then + export PATH="$HOME/miniconda/bin:$PATH" + source "$HOME/miniconda/etc/profile.d/conda.sh" + conda activate myenv + fi + uv sync --frozen --all-groups --all-extras --python "$(which python)" - save_cache: paths: - /home/circleci/.pyenv - /home/circleci/.local - key: v1-llm-responses-deps-{{ checksum "requirements.txt" }} + key: v1-llm-responses-deps-{{ checksum "uv.lock" }} # Run pytest and generate JUnit XML report - run: name: Run tests command: | pwd ls - python -m pytest -v tests/llm_responses_api_testing -x --junitxml=test-results/junit.xml --durations=5 -n 8 + uv run --no-sync python -m pytest -v tests/llm_responses_api_testing -x --junitxml=test-results/junit.xml --durations=5 -n 8 no_output_timeout: 15m # Store test results @@ -920,16 +859,21 @@ jobs: - run: name: Install Dependencies command: | - python -m pip install --upgrade pip uv - uv pip install --system -r requirements.txt - pip install "pytest==7.3.1" "pytest-retry==1.6.3" "pytest-cov==5.0.0" "pytest-asyncio==0.21.1" "respx==0.22.0" "pytest-xdist==3.6.1" + curl -LsSf https://astral.sh/uv/0.10.9/install.sh | env UV_NO_MODIFY_PATH=1 sh + export PATH="$HOME/.local/bin:$PATH" + if [ -f "$HOME/miniconda/etc/profile.d/conda.sh" ]; then + export PATH="$HOME/miniconda/bin:$PATH" + source "$HOME/miniconda/etc/profile.d/conda.sh" + conda activate myenv + fi + uv sync --frozen --all-groups --all-extras --python "$(which python)" # Run pytest and generate JUnit XML report - run: name: Run tests command: | pwd ls - python -m pytest -vv tests/ocr_tests --cov=litellm --cov-report=xml -x -v --junitxml=test-results/junit.xml --durations=5 -n 4 + uv run --no-sync python -m pytest -vv tests/ocr_tests --cov=litellm --cov-report=xml -x -v --junitxml=test-results/junit.xml --durations=5 -n 4 no_output_timeout: 15m - run: name: Rename the coverage files @@ -959,16 +903,21 @@ jobs: - run: name: Install Dependencies command: | - python -m pip install --upgrade pip uv - uv pip install --system -r requirements.txt - pip install "pytest==7.3.1" "pytest-retry==1.6.3" "pytest-cov==5.0.0" "pytest-asyncio==0.21.1" "respx==0.22.0" "pytest-xdist==3.6.1" + curl -LsSf https://astral.sh/uv/0.10.9/install.sh | env UV_NO_MODIFY_PATH=1 sh + export PATH="$HOME/.local/bin:$PATH" + if [ -f "$HOME/miniconda/etc/profile.d/conda.sh" ]; then + export PATH="$HOME/miniconda/bin:$PATH" + source "$HOME/miniconda/etc/profile.d/conda.sh" + conda activate myenv + fi + uv sync --frozen --all-groups --all-extras --python "$(which python)" # Run pytest and generate JUnit XML report - run: name: Run tests command: | pwd ls - python -m pytest -vv tests/search_tests --cov=litellm --cov-report=xml -x -v --junitxml=test-results/junit.xml --durations=5 -n 4 + uv run --no-sync python -m pytest -vv tests/search_tests --cov=litellm --cov-report=xml -x -v --junitxml=test-results/junit.xml --durations=5 -n 4 no_output_timeout: 15m - run: name: Rename the coverage files @@ -1000,7 +949,7 @@ jobs: command: | prisma generate export PYTHONUNBUFFERED=1 - python -m pytest tests/test_litellm/proxy/guardrails tests/test_litellm/proxy/management_endpoints tests/test_litellm/proxy/_experimental tests/test_litellm/proxy/client tests/test_litellm/proxy/auth --junitxml=test-results/junit-proxy-part1.xml --durations=10 -n 4 --maxfail=5 --timeout=60 -vv --log-cli-level=WARNING -r A + uv run --no-sync python -m pytest tests/test_litellm/proxy/guardrails tests/test_litellm/proxy/management_endpoints tests/test_litellm/proxy/_experimental tests/test_litellm/proxy/client tests/test_litellm/proxy/auth --junitxml=test-results/junit-proxy-part1.xml --durations=10 -n 4 --maxfail=5 --timeout=60 -vv --log-cli-level=WARNING -r A no_output_timeout: 15m - store_test_results: path: test-results @@ -1019,7 +968,7 @@ jobs: command: | prisma generate export PYTHONUNBUFFERED=1 - python -m pytest tests/test_litellm/proxy --ignore=tests/test_litellm/proxy/guardrails --ignore=tests/test_litellm/proxy/management_endpoints --ignore=tests/test_litellm/proxy/_experimental --ignore=tests/test_litellm/proxy/client --ignore=tests/test_litellm/proxy/auth --junitxml=test-results/junit-proxy-part2.xml --durations=10 -n 4 --maxfail=5 --timeout=120 -vv --log-cli-level=WARNING -r A + uv run --no-sync python -m pytest tests/test_litellm/proxy --ignore=tests/test_litellm/proxy/guardrails --ignore=tests/test_litellm/proxy/management_endpoints --ignore=tests/test_litellm/proxy/_experimental --ignore=tests/test_litellm/proxy/client --ignore=tests/test_litellm/proxy/auth --junitxml=test-results/junit-proxy-part2.xml --durations=10 -n 4 --maxfail=5 --timeout=120 -vv --log-cli-level=WARNING -r A no_output_timeout: 15m - store_test_results: path: test-results @@ -1038,23 +987,14 @@ jobs: - run: name: Install Dependencies command: | - python -m pip install --upgrade pip uv - uv pip install --system -r requirements.txt - pip install "pytest-mock==3.12.0" - pip install "pytest==7.3.1" - pip install "pytest-retry==1.6.3" - pip install "pytest-cov==5.0.0" - pip install "pytest-asyncio==0.21.1" - pip install "respx==0.22.0" - pip install "hypercorn==0.17.3" - pip install "pydantic==2.12.5" - pip install "mcp==1.26.0" - pip install "requests-mock>=1.12.1" - pip install "responses==0.25.7" - pip install "pytest-xdist==3.6.1" - pip install "semantic_router==0.1.10" --no-deps - pip install aurelio_sdk - pip install "fastapi-offline==1.7.3" + curl -LsSf https://astral.sh/uv/0.10.9/install.sh | env UV_NO_MODIFY_PATH=1 sh + export PATH="$HOME/.local/bin:$PATH" + if [ -f "$HOME/miniconda/etc/profile.d/conda.sh" ]; then + export PATH="$HOME/miniconda/bin:$PATH" + source "$HOME/miniconda/etc/profile.d/conda.sh" + conda activate myenv + fi + uv sync --frozen --all-groups --all-extras --python "$(which python)" - setup_litellm_enterprise_pip - run: name: Run enterprise tests @@ -1062,7 +1002,7 @@ jobs: pwd ls prisma generate - python -m pytest -v tests/enterprise -x --junitxml=test-results/junit-enterprise.xml --durations=10 -n 4 + uv run --no-sync python -m pytest -v tests/enterprise -x --junitxml=test-results/junit-enterprise.xml --durations=10 -n 4 no_output_timeout: 15m # Store test results - store_test_results: @@ -1081,23 +1021,21 @@ jobs: - run: name: Install Dependencies command: | - python -m pip install --upgrade pip uv - uv pip install --system -r requirements.txt - pip install "respx==0.22.0" - pip install "pytest==7.3.1" - pip install "pytest-retry==1.6.3" - pip install "pytest-asyncio==0.21.1" - pip install "pytest-cov==5.0.0" - pip install "google-generativeai==0.3.2" - pip install "google-cloud-aiplatform==1.133.0" - pip install "pytest-xdist==3.6.1" + curl -LsSf https://astral.sh/uv/0.10.9/install.sh | env UV_NO_MODIFY_PATH=1 sh + export PATH="$HOME/.local/bin:$PATH" + if [ -f "$HOME/miniconda/etc/profile.d/conda.sh" ]; then + export PATH="$HOME/miniconda/bin:$PATH" + source "$HOME/miniconda/etc/profile.d/conda.sh" + conda activate myenv + fi + uv sync --frozen --all-groups --all-extras --python "$(which python)" # Run pytest and generate JUnit XML report - run: name: Run tests command: | pwd ls - python -m pytest -vv tests/batches_tests --cov=litellm --cov-report=xml -x -s -v --junitxml=test-results/junit.xml --durations=5 -n 2 + uv run --no-sync python -m pytest -vv tests/batches_tests --cov=litellm --cov-report=xml -x -s -v --junitxml=test-results/junit.xml --durations=5 -n 2 no_output_timeout: 15m - run: name: Rename the coverage files @@ -1127,25 +1065,21 @@ jobs: - run: name: Install Dependencies command: | - python -m pip install --upgrade pip uv - uv pip install --system -r requirements.txt - pip install numpydoc - pip install "respx==0.22.0" - pip install "pytest==7.3.1" - pip install "pytest-retry==1.6.3" - pip install "pytest-asyncio==0.21.1" - pip install "pytest-cov==5.0.0" - pip install "google-generativeai==0.3.2" - pip install "google-cloud-aiplatform==1.133.0" - pip install pytest-mock - pip install "pytest-xdist==3.6.1" + curl -LsSf https://astral.sh/uv/0.10.9/install.sh | env UV_NO_MODIFY_PATH=1 sh + export PATH="$HOME/.local/bin:$PATH" + if [ -f "$HOME/miniconda/etc/profile.d/conda.sh" ]; then + export PATH="$HOME/miniconda/bin:$PATH" + source "$HOME/miniconda/etc/profile.d/conda.sh" + conda activate myenv + fi + uv sync --frozen --all-groups --all-extras --python "$(which python)" # Run pytest and generate JUnit XML report - run: name: Run tests command: | pwd ls - python -m pytest -vv tests/litellm_utils_tests --cov=litellm --cov-report=xml -x -s -v --junitxml=test-results/junit.xml --durations=5 -n 2 + uv run --no-sync python -m pytest -vv tests/litellm_utils_tests --cov=litellm --cov-report=xml -x -s -v --junitxml=test-results/junit.xml --durations=5 -n 2 no_output_timeout: 15m - run: name: Rename the coverage files @@ -1176,16 +1110,21 @@ jobs: - run: name: Install Dependencies command: | - python -m pip install --upgrade pip uv - uv pip install --system -r requirements.txt - pip install "pytest==7.3.1" "pytest-retry==1.6.3" "pytest-cov==5.0.0" "pytest-asyncio==0.21.1" "respx==0.22.0" "pytest-xdist==3.6.1" + curl -LsSf https://astral.sh/uv/0.10.9/install.sh | env UV_NO_MODIFY_PATH=1 sh + export PATH="$HOME/.local/bin:$PATH" + if [ -f "$HOME/miniconda/etc/profile.d/conda.sh" ]; then + export PATH="$HOME/miniconda/bin:$PATH" + source "$HOME/miniconda/etc/profile.d/conda.sh" + conda activate myenv + fi + uv sync --frozen --all-groups --all-extras --python "$(which python)" # Run pytest and generate JUnit XML report - run: name: Run tests command: | pwd ls - python -m pytest -vv tests/pass_through_unit_tests --cov=litellm --cov-report=xml -x -v --junitxml=test-results/junit.xml --durations=5 -n 4 + uv run --no-sync python -m pytest -vv tests/pass_through_unit_tests --cov=litellm --cov-report=xml -x -v --junitxml=test-results/junit.xml --durations=5 -n 4 no_output_timeout: 15m - run: name: Rename the coverage files @@ -1216,21 +1155,21 @@ jobs: - run: name: Install Dependencies command: | - python -m pip install --upgrade pip uv - uv pip install --system -r requirements.txt - pip install "pytest==7.3.1" - pip install "pytest-retry==1.6.3" - pip install "pytest-cov==5.0.0" - pip install "pytest-asyncio==0.21.1" - pip install "respx==0.22.0" - pip install "pytest-xdist==3.6.1" + curl -LsSf https://astral.sh/uv/0.10.9/install.sh | env UV_NO_MODIFY_PATH=1 sh + export PATH="$HOME/.local/bin:$PATH" + if [ -f "$HOME/miniconda/etc/profile.d/conda.sh" ]; then + export PATH="$HOME/miniconda/bin:$PATH" + source "$HOME/miniconda/etc/profile.d/conda.sh" + conda activate myenv + fi + uv sync --frozen --all-groups --all-extras --python "$(which python)" # Run pytest and generate JUnit XML report - run: name: Run tests command: | pwd ls - python -m pytest -v tests/image_gen_tests -n 4 -x --junitxml=test-results/junit.xml --durations=5 + uv run --no-sync python -m pytest -v tests/image_gen_tests -n 4 -x --junitxml=test-results/junit.xml --durations=5 no_output_timeout: 15m # Store test results - store_test_results: @@ -1249,21 +1188,14 @@ jobs: - run: name: Install Dependencies command: | - python -m pip install --upgrade pip uv - uv pip install --system -r requirements.txt - pip install "pytest==7.3.1" - pip install "pytest-retry==1.6.3" - pip install "pytest-cov==5.0.0" - pip install "pytest-asyncio==0.21.1" - pip install pytest-mock - pip install "respx==0.22.0" - pip install "google-generativeai==0.3.2" - pip install "google-cloud-aiplatform==1.133.0" - pip install "mlflow==2.17.2" - pip install "anthropic==0.54.0" - pip install "blockbuster==1.5.24" - pip install "pytest-xdist==3.6.1" - pip install "pytest-timeout==2.2.0" + curl -LsSf https://astral.sh/uv/0.10.9/install.sh | env UV_NO_MODIFY_PATH=1 sh + export PATH="$HOME/.local/bin:$PATH" + if [ -f "$HOME/miniconda/etc/profile.d/conda.sh" ]; then + export PATH="$HOME/miniconda/bin:$PATH" + source "$HOME/miniconda/etc/profile.d/conda.sh" + conda activate myenv + fi + uv sync --frozen --all-groups --all-extras --python "$(which python)" # Run pytest and generate JUnit XML report - setup_litellm_enterprise_pip - run: @@ -1271,7 +1203,7 @@ jobs: command: | pwd ls - LITELLM_LOG=WARNING python -m pytest tests/logging_callback_tests -vv --cov=litellm --cov-report=xml -n 4 --junitxml=test-results/junit.xml --durations=5 --timeout=120 --timeout_method=thread + LITELLM_LOG=WARNING uv run --no-sync python -m pytest tests/logging_callback_tests -vv --cov=litellm --cov-report=xml -n 4 --junitxml=test-results/junit.xml --durations=5 --timeout=120 --timeout_method=thread no_output_timeout: 15m - run: name: Rename the coverage files @@ -1301,20 +1233,21 @@ jobs: - run: name: Install Dependencies command: | - python -m pip install --upgrade pip uv - uv pip install --system -r requirements.txt - pip install "pytest==7.3.1" - pip install "pytest-retry==1.6.3" - pip install "pytest-cov==5.0.0" - pip install "pytest-asyncio==0.21.1" - pip install "respx==0.22.0" + curl -LsSf https://astral.sh/uv/0.10.9/install.sh | env UV_NO_MODIFY_PATH=1 sh + export PATH="$HOME/.local/bin:$PATH" + if [ -f "$HOME/miniconda/etc/profile.d/conda.sh" ]; then + export PATH="$HOME/miniconda/bin:$PATH" + source "$HOME/miniconda/etc/profile.d/conda.sh" + conda activate myenv + fi + uv sync --frozen --all-groups --all-extras --python "$(which python)" # Run pytest and generate JUnit XML report - run: name: Run tests command: | pwd ls - python -m pytest -vv tests/audio_tests --cov=litellm --cov-report=xml -x -s -v --junitxml=test-results/junit.xml --durations=5 + uv run --no-sync python -m pytest -vv tests/audio_tests --cov=litellm --cov-report=xml -x -s -v --junitxml=test-results/junit.xml --durations=5 no_output_timeout: 15m - run: name: Rename the coverage files @@ -1344,26 +1277,21 @@ jobs: - run: name: Install Dependencies command: | - python -m pip install --upgrade pip - pip install python-dotenv - pip install pytest - pip install tiktoken - pip install aiohttp - pip install openai - pip install click - pip install "boto3==1.42.80" - pip install jinja2 - pip install "tokenizers==0.22.2" - pip install "uvloop==0.21.0" - pip install "fastuuid==0.14.0" - pip install jsonschema + curl -LsSf https://astral.sh/uv/0.10.9/install.sh | env UV_NO_MODIFY_PATH=1 sh + export PATH="$HOME/.local/bin:$PATH" + if [ -f "$HOME/miniconda/etc/profile.d/conda.sh" ]; then + export PATH="$HOME/miniconda/bin:$PATH" + source "$HOME/miniconda/etc/profile.d/conda.sh" + conda activate myenv + fi + uv sync --frozen --all-groups --all-extras --python "$(which python)" - setup_litellm_enterprise_pip - run: name: Run tests command: | pwd ls - python -m pytest -vv tests/local_testing/test_basic_python_version.py + uv run --no-sync python -m pytest -vv tests/local_testing/test_basic_python_version.py installing_litellm_on_python_3_13: docker: @@ -1380,21 +1308,20 @@ jobs: - run: name: Install Dependencies command: | - python -m pip install --upgrade pip uv - pip install wheel setuptools - uv pip install --system -r requirements.txt - pip install "pytest==7.3.1" - pip install "pytest-retry==1.6.3" - pip install "pytest-asyncio==0.21.1" - pip install "pytest-cov==5.0.0" - pip install "tomli==2.2.1" - pip install "mcp==1.26.0" + curl -LsSf https://astral.sh/uv/0.10.9/install.sh | env UV_NO_MODIFY_PATH=1 sh + export PATH="$HOME/.local/bin:$PATH" + if [ -f "$HOME/miniconda/etc/profile.d/conda.sh" ]; then + export PATH="$HOME/miniconda/bin:$PATH" + source "$HOME/miniconda/etc/profile.d/conda.sh" + conda activate myenv + fi + uv sync --frozen --all-groups --all-extras --python "$(which python)" - run: name: Run tests command: | pwd ls - python -m pytest -v tests/local_testing/test_basic_python_version.py + uv run --no-sync python -m pytest -v tests/local_testing/test_basic_python_version.py helm_chart_testing: machine: image: ubuntu-2204:2023.10.1 # Use machine executor instead of docker @@ -1495,41 +1422,42 @@ jobs: - run: name: Install Dependencies command: | - python -m pip install --upgrade pip - pip install ruff - pip install pylint - pip install pyright - pip install beautifulsoup4 - pip install . - curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash - - run: python -c "from litellm import *" || (echo '🚨 import failed, this means you introduced unprotected imports! 🚨'; exit 1) + curl -LsSf https://astral.sh/uv/0.10.9/install.sh | env UV_NO_MODIFY_PATH=1 sh + export PATH="$HOME/.local/bin:$PATH" + if [ -f "$HOME/miniconda/etc/profile.d/conda.sh" ]; then + export PATH="$HOME/miniconda/bin:$PATH" + source "$HOME/miniconda/etc/profile.d/conda.sh" + conda activate myenv + fi + uv sync --frozen --all-groups --all-extras --python "$(which python)" + - run: uv run --no-sync python -c "from litellm import *" || (echo '🚨 import failed, this means you introduced unprotected imports! 🚨'; exit 1) - run: ruff check ./litellm # - run: python ./tests/documentation_tests/test_general_setting_keys.py - - run: python ./tests/code_coverage_tests/check_licenses.py - - run: python ./tests/code_coverage_tests/check_provider_folders_documented.py - - run: python ./tests/code_coverage_tests/router_code_coverage.py - - run: python ./tests/code_coverage_tests/test_chat_completion_imports.py - - run: python ./tests/code_coverage_tests/info_log_check.py - - run: python ./tests/code_coverage_tests/check_guardrail_apply_decorator.py - - run: python ./tests/code_coverage_tests/test_ban_set_verbose.py - - run: python ./tests/code_coverage_tests/code_qa_check_tests.py - - run: python ./tests/code_coverage_tests/check_get_model_cost_key_performance.py - - run: python ./tests/code_coverage_tests/test_proxy_types_import.py - - run: python ./tests/code_coverage_tests/callback_manager_test.py - - run: python ./tests/code_coverage_tests/recursive_detector.py - - run: python ./tests/code_coverage_tests/test_router_strategy_async.py - - run: python ./tests/code_coverage_tests/litellm_logging_code_coverage.py - - run: python ./tests/documentation_tests/test_env_keys.py - - run: python ./tests/documentation_tests/test_router_settings.py - - run: python ./tests/documentation_tests/test_api_docs.py - - run: python ./tests/code_coverage_tests/ensure_async_clients_test.py - - run: python ./tests/code_coverage_tests/enforce_llms_folder_style.py - - run: python ./tests/documentation_tests/test_circular_imports.py - - run: python ./tests/code_coverage_tests/prevent_key_leaks_in_exceptions.py - - run: python ./tests/code_coverage_tests/check_unsafe_enterprise_import.py - - run: python ./tests/code_coverage_tests/ban_copy_deepcopy_kwargs.py - - run: python ./tests/code_coverage_tests/check_fastuuid_usage.py - - run: python ./tests/code_coverage_tests/memory_test.py + - run: uv run --no-sync python ./tests/code_coverage_tests/check_licenses.py + - run: uv run --no-sync python ./tests/code_coverage_tests/check_provider_folders_documented.py + - run: uv run --no-sync python ./tests/code_coverage_tests/router_code_coverage.py + - run: uv run --no-sync python ./tests/code_coverage_tests/test_chat_completion_imports.py + - run: uv run --no-sync python ./tests/code_coverage_tests/info_log_check.py + - run: uv run --no-sync python ./tests/code_coverage_tests/check_guardrail_apply_decorator.py + - run: uv run --no-sync python ./tests/code_coverage_tests/test_ban_set_verbose.py + - run: uv run --no-sync python ./tests/code_coverage_tests/code_qa_check_tests.py + - run: uv run --no-sync python ./tests/code_coverage_tests/check_get_model_cost_key_performance.py + - run: uv run --no-sync python ./tests/code_coverage_tests/test_proxy_types_import.py + - run: uv run --no-sync python ./tests/code_coverage_tests/callback_manager_test.py + - run: uv run --no-sync python ./tests/code_coverage_tests/recursive_detector.py + - run: uv run --no-sync python ./tests/code_coverage_tests/test_router_strategy_async.py + - run: uv run --no-sync python ./tests/code_coverage_tests/litellm_logging_code_coverage.py + - run: uv run --no-sync python ./tests/documentation_tests/test_env_keys.py + - run: uv run --no-sync python ./tests/documentation_tests/test_router_settings.py + - run: uv run --no-sync python ./tests/documentation_tests/test_api_docs.py + - run: uv run --no-sync python ./tests/code_coverage_tests/ensure_async_clients_test.py + - run: uv run --no-sync python ./tests/code_coverage_tests/enforce_llms_folder_style.py + - run: uv run --no-sync python ./tests/documentation_tests/test_circular_imports.py + - run: uv run --no-sync python ./tests/code_coverage_tests/prevent_key_leaks_in_exceptions.py + - run: uv run --no-sync python ./tests/code_coverage_tests/check_unsafe_enterprise_import.py + - run: uv run --no-sync python ./tests/code_coverage_tests/ban_copy_deepcopy_kwargs.py + - run: uv run --no-sync python ./tests/code_coverage_tests/check_fastuuid_usage.py + - run: uv run --no-sync python ./tests/code_coverage_tests/memory_test.py - run: helm lint ./deploy/charts/litellm-helm db_migration_disable_update_check: @@ -1554,10 +1482,14 @@ jobs: - run: name: Install Dependencies command: | - pip install "pytest==7.3.1" - pip install "pytest-asyncio==0.21.1" - pip install aiohttp - pip install apscheduler + curl -LsSf https://astral.sh/uv/0.10.9/install.sh | env UV_NO_MODIFY_PATH=1 sh + export PATH="$HOME/.local/bin:$PATH" + if [ -f "$HOME/miniconda/etc/profile.d/conda.sh" ]; then + export PATH="$HOME/miniconda/bin:$PATH" + source "$HOME/miniconda/etc/profile.d/conda.sh" + conda activate myenv + fi + uv sync --frozen --all-groups --all-extras --python "$(which python)" - run: name: Install dockerize command: | @@ -1640,7 +1572,7 @@ jobs: - run: name: Run Basic Proxy Startup Tests (Health Readiness and Chat Completion) command: | - python -m pytest -v tests/basic_proxy_startup_tests -x --junitxml=test-results/junit-2.xml --durations=5 + uv run --no-sync python -m pytest -v tests/basic_proxy_startup_tests -x --junitxml=test-results/junit-2.xml --durations=5 no_output_timeout: 15m build_and_test: @@ -1667,36 +1599,14 @@ jobs: - run: name: Install Dependencies command: | - pip install "pytest==7.3.1" - pip install "pytest-asyncio==0.21.1" - pip install aiohttp - python -m pip install --upgrade pip - python -m pip install -r .circleci/requirements.txt - pip install "pytest==7.3.1" - pip install "pytest-retry==1.6.3" - pip install "pytest-mock==3.12.0" - pip install "pytest-asyncio==0.21.1" - pip install "mypy==1.18.2" - pip install "google-generativeai==0.3.2" - pip install "google-cloud-aiplatform==1.133.0" - pip install pyarrow - pip install "boto3==1.42.80" - pip install langchain - pip install "langfuse>=2.0.0" - pip install "logfire==0.29.0" - pip install numpydoc - pip install prisma - pip install fastapi - pip install jsonschema - pip install "httpx==0.28.1" - pip install "gunicorn==23.0.0" - pip install "anyio==4.8.0" - pip install "aiodynamo==23.10.1" - pip install "asyncio==3.4.3" - pip install "PyGithub==1.59.1" - pip install "openai==1.100.1" - pip install "litellm[proxy]" - pip install "pytest-xdist==3.6.1" + curl -LsSf https://astral.sh/uv/0.10.9/install.sh | env UV_NO_MODIFY_PATH=1 sh + export PATH="$HOME/.local/bin:$PATH" + if [ -f "$HOME/miniconda/etc/profile.d/conda.sh" ]; then + export PATH="$HOME/miniconda/bin:$PATH" + source "$HOME/miniconda/etc/profile.d/conda.sh" + conda activate myenv + fi + uv sync --frozen --all-groups --all-extras --python "$(which python)" - run: name: Install dockerize command: | @@ -1775,7 +1685,7 @@ jobs: command: | pwd ls - python -m pytest -s -v tests/*.py -x --junitxml=test-results/junit.xml -n 4 --durations=5 --ignore=tests/otel_tests --ignore=tests/spend_tracking_tests --ignore=tests/pass_through_tests --ignore=tests/proxy_admin_ui_tests --ignore=tests/load_tests --ignore=tests/llm_translation --ignore=tests/llm_responses_api_testing --ignore=tests/mcp_tests --ignore=tests/guardrails_tests --ignore=tests/image_gen_tests --ignore=tests/pass_through_unit_tests + uv run --no-sync python -m pytest -s -v tests/*.py -x --junitxml=test-results/junit.xml -n 4 --durations=5 --ignore=tests/otel_tests --ignore=tests/spend_tracking_tests --ignore=tests/pass_through_tests --ignore=tests/proxy_admin_ui_tests --ignore=tests/load_tests --ignore=tests/llm_translation --ignore=tests/llm_responses_api_testing --ignore=tests/mcp_tests --ignore=tests/guardrails_tests --ignore=tests/image_gen_tests --ignore=tests/pass_through_unit_tests no_output_timeout: 15m # Store test results @@ -1809,37 +1719,14 @@ jobs: - run: name: Install Dependencies command: | - pip install "pytest==7.3.1" - pip install "pytest-asyncio==0.21.1" - pip install aiohttp - python -m pip install --upgrade pip - python -m pip install -r .circleci/requirements.txt - pip install "pytest==7.3.1" - pip install "pytest-retry==1.6.3" - pip install "pytest-mock==3.12.0" - pip install "pytest-asyncio==0.21.1" - pip install "mypy==1.18.2" - pip install "jsonlines==4.0.0" - pip install "google-generativeai==0.3.2" - pip install "google-cloud-aiplatform==1.133.0" - pip install pyarrow - pip install "boto3==1.42.80" - pip install langchain - pip install "langchain_mcp_adapters==0.0.5" - pip install "langfuse>=2.0.0" - pip install "logfire==0.29.0" - pip install numpydoc - pip install prisma - pip install fastapi - pip install jsonschema - pip install "httpx==0.28.1" - pip install "gunicorn==23.0.0" - pip install "anyio==4.8.0" - pip install "aiodynamo==23.10.1" - pip install "asyncio==3.4.3" - pip install "PyGithub==1.59.1" - pip install "openai==1.100.1" - # Run pytest and generate JUnit XML report + curl -LsSf https://astral.sh/uv/0.10.9/install.sh | env UV_NO_MODIFY_PATH=1 sh + export PATH="$HOME/.local/bin:$PATH" + if [ -f "$HOME/miniconda/etc/profile.d/conda.sh" ]; then + export PATH="$HOME/miniconda/bin:$PATH" + source "$HOME/miniconda/etc/profile.d/conda.sh" + conda activate myenv + fi + uv sync --frozen --all-groups --all-extras --python "$(which python)" - run: name: Install dockerize command: | @@ -1921,7 +1808,7 @@ jobs: command: | pwd ls - python -m pytest -s -vv tests/openai_endpoints_tests --junitxml=test-results/junit.xml --durations=5 + uv run --no-sync python -m pytest -s -vv tests/openai_endpoints_tests --junitxml=test-results/junit.xml --durations=5 no_output_timeout: 15m # Store test results @@ -1955,34 +1842,14 @@ jobs: - run: name: Install Dependencies command: | - pip install "pytest==7.3.1" - pip install "pytest-asyncio==0.21.1" - pip install aiohttp - python -m pip install --upgrade pip - python -m pip install -r .circleci/requirements.txt - pip install "pytest==7.3.1" - pip install "pytest-retry==1.6.3" - pip install "pytest-mock==3.12.0" - pip install "pytest-asyncio==0.21.1" - pip install "mypy==1.18.2" - pip install "google-generativeai==0.3.2" - pip install "google-cloud-aiplatform==1.133.0" - pip install pyarrow - pip install "boto3==1.42.80" - pip install langchain - pip install "langfuse>=2.0.0" - pip install "logfire==0.29.0" - pip install numpydoc - pip install prisma - pip install fastapi - pip install jsonschema - pip install "httpx==0.28.1" - pip install "gunicorn==23.0.0" - pip install "anyio==4.8.0" - pip install "aiodynamo==23.10.1" - pip install "asyncio==3.4.3" - pip install "PyGithub==1.59.1" - pip install "openai==1.100.1" + curl -LsSf https://astral.sh/uv/0.10.9/install.sh | env UV_NO_MODIFY_PATH=1 sh + export PATH="$HOME/.local/bin:$PATH" + if [ -f "$HOME/miniconda/etc/profile.d/conda.sh" ]; then + export PATH="$HOME/miniconda/bin:$PATH" + source "$HOME/miniconda/etc/profile.d/conda.sh" + conda activate myenv + fi + uv sync --frozen --all-groups --all-extras --python "$(which python)" - run: name: Install dockerize command: | @@ -2061,7 +1928,7 @@ jobs: command: | pwd ls - python -m pytest -v tests/otel_tests -x --junitxml=test-results/junit.xml --durations=5 + uv run --no-sync python -m pytest -v tests/otel_tests -x --junitxml=test-results/junit.xml --durations=5 no_output_timeout: 15m # Clean up first container - run: @@ -2104,7 +1971,7 @@ jobs: - run: name: Run second round of tests command: | - python -m pytest -v tests/basic_proxy_startup_tests -x --junitxml=test-results/junit-2.xml --durations=5 + uv run --no-sync python -m pytest -v tests/basic_proxy_startup_tests -x --junitxml=test-results/junit-2.xml --durations=5 no_output_timeout: 15m # Store test results @@ -2138,11 +2005,14 @@ jobs: - run: name: Install Dependencies command: | - pip install "pytest==7.3.1" - pip install "pytest-asyncio==0.21.1" - pip install aiohttp - python -m pip install --upgrade pip - python -m pip install -r requirements.txt + curl -LsSf https://astral.sh/uv/0.10.9/install.sh | env UV_NO_MODIFY_PATH=1 sh + export PATH="$HOME/.local/bin:$PATH" + if [ -f "$HOME/miniconda/etc/profile.d/conda.sh" ]; then + export PATH="$HOME/miniconda/bin:$PATH" + source "$HOME/miniconda/etc/profile.d/conda.sh" + conda activate myenv + fi + uv sync --frozen --all-groups --all-extras --python "$(which python)" - run: name: Install dockerize command: | @@ -2213,7 +2083,7 @@ jobs: command: | pwd ls - python -m pytest -vv tests/spend_tracking_tests -x --junitxml=test-results/junit.xml --durations=5 + uv run --no-sync python -m pytest -vv tests/spend_tracking_tests -x --junitxml=test-results/junit.xml --durations=5 no_output_timeout: 15m # Clean up first container - run: @@ -2250,15 +2120,14 @@ jobs: - run: name: Install Dependencies command: | - pip install "pytest==7.3.1" - pip install "pytest-asyncio==0.21.1" - pip install aiohttp - python -m pip install --upgrade pip - python -m pip install -r requirements.txt - pip install "pytest==7.3.1" - pip install "pytest-retry==1.6.3" - pip install "pytest-mock==3.12.0" - pip install "pytest-asyncio==0.21.1" + curl -LsSf https://astral.sh/uv/0.10.9/install.sh | env UV_NO_MODIFY_PATH=1 sh + export PATH="$HOME/.local/bin:$PATH" + if [ -f "$HOME/miniconda/etc/profile.d/conda.sh" ]; then + export PATH="$HOME/miniconda/bin:$PATH" + source "$HOME/miniconda/etc/profile.d/conda.sh" + conda activate myenv + fi + uv sync --frozen --all-groups --all-extras --python "$(which python)" - run: name: Install dockerize command: | @@ -2352,7 +2221,7 @@ jobs: command: | pwd ls - python -m pytest -vv tests/multi_instance_e2e_tests -x --junitxml=test-results/junit.xml --durations=5 + uv run --no-sync python -m pytest -vv tests/multi_instance_e2e_tests -x --junitxml=test-results/junit.xml --durations=5 no_output_timeout: 15m # Clean up first container # Store test results @@ -2388,16 +2257,14 @@ jobs: - run: name: Install Dependencies command: | - pip install "pytest==7.3.1" - pip install "pytest-asyncio==0.21.1" - pip install aiohttp - python -m pip install --upgrade pip - python -m pip install -r requirements.txt - pip install "pytest==7.3.1" - pip install "pytest-retry==1.6.3" - pip install "pytest-mock==3.12.0" - pip install "pytest-asyncio==0.21.1" - pip install "assemblyai==0.37.0" + curl -LsSf https://astral.sh/uv/0.10.9/install.sh | env UV_NO_MODIFY_PATH=1 sh + export PATH="$HOME/.local/bin:$PATH" + if [ -f "$HOME/miniconda/etc/profile.d/conda.sh" ]; then + export PATH="$HOME/miniconda/bin:$PATH" + source "$HOME/miniconda/etc/profile.d/conda.sh" + conda activate myenv + fi + uv sync --frozen --all-groups --all-extras --python "$(which python)" - run: name: Install dockerize command: | @@ -2462,7 +2329,7 @@ jobs: command: | pwd ls - python -m pytest -vv tests/store_model_in_db_tests -x --junitxml=test-results/junit.xml --durations=5 + uv run --no-sync python -m pytest -vv tests/store_model_in_db_tests -x --junitxml=test-results/junit.xml --durations=5 no_output_timeout: 15m - run: name: Stop and remove containers @@ -2499,9 +2366,14 @@ jobs: - run: name: Install Dependencies command: | - python -m pip install --upgrade pip - pip install "pytest==7.3.1" "pytest-asyncio==0.21.1" "pytest-retry==1.6.3" \ - "pytest-mock==3.12.0" "mypy==1.18.2" aiohttp apscheduler + curl -LsSf https://astral.sh/uv/0.10.9/install.sh | env UV_NO_MODIFY_PATH=1 sh + export PATH="$HOME/.local/bin:$PATH" + if [ -f "$HOME/miniconda/etc/profile.d/conda.sh" ]; then + export PATH="$HOME/miniconda/bin:$PATH" + source "$HOME/miniconda/etc/profile.d/conda.sh" + conda activate myenv + fi + uv sync --frozen --all-groups --all-extras --python "$(which python)" - run: name: Build Docker image command: | @@ -2568,7 +2440,7 @@ jobs: - run: name: Run tests command: | - python -m pytest -vv tests/basic_proxy_startup_tests -x --junitxml=test-results/junit-2.xml --durations=5 + uv run --no-sync python -m pytest -vv tests/basic_proxy_startup_tests -x --junitxml=test-results/junit-2.xml --durations=5 no_output_timeout: 15m # Clean up first container - run: @@ -2601,39 +2473,14 @@ jobs: - run: name: Install Dependencies command: | - export PATH="$HOME/miniconda/bin:$PATH" - source $HOME/miniconda/etc/profile.d/conda.sh - conda activate myenv - pip install "pytest==7.3.1" - pip install "pytest-retry==1.6.3" - pip install "pytest-asyncio==0.21.1" - pip install "google-cloud-aiplatform==1.133.0" - pip install aiohttp - pip install "openai==1.100.1" - pip install "assemblyai==0.37.0" - python -m pip install --upgrade pip - pip install "pydantic==2.12.5" - pip install "pytest==7.3.1" - pip install "pytest-mock==3.12.0" - pip install "pytest-asyncio==0.21.1" - pip install "boto3==1.42.80" - pip install "mypy==1.18.2" - pip install pyarrow - pip install numpydoc - pip install prisma - pip install fastapi - pip install jsonschema - pip install "httpx==0.27.0" - pip install "anyio==4.8.0" - pip install "asyncio==3.4.3" - pip install "PyGithub==1.59.1" - pip install "google-cloud-aiplatform==1.59.0" - pip install "anthropic==0.54.0" - pip install "langchain_mcp_adapters==0.0.5" - pip install "langchain_openai==0.2.1" - pip install "langgraph==0.3.18" - pip install "fastuuid==0.13.5" - pip install -r requirements.txt + curl -LsSf https://astral.sh/uv/0.10.9/install.sh | env UV_NO_MODIFY_PATH=1 sh + export PATH="$HOME/.local/bin:$PATH" + if [ -f "$HOME/miniconda/etc/profile.d/conda.sh" ]; then + export PATH="$HOME/miniconda/bin:$PATH" + source "$HOME/miniconda/etc/profile.d/conda.sh" + conda activate myenv + fi + uv sync --frozen --all-groups --all-extras --python "$(which python)" - run: name: Install dockerize command: | @@ -2755,7 +2602,7 @@ jobs: conda activate myenv pwd ls - python -m pytest -v tests/pass_through_tests/ -x --junitxml=test-results/junit.xml --durations=5 + uv run --no-sync python -m pytest -v tests/pass_through_tests/ -x --junitxml=test-results/junit.xml --durations=5 no_output_timeout: 15m # Store test results @@ -2790,15 +2637,14 @@ jobs: - run: name: Install Dependencies command: | - export PATH="$HOME/miniconda/bin:$PATH" - source $HOME/miniconda/etc/profile.d/conda.sh - conda activate myenv - pip install "pytest==7.3.1" - pip install "pytest-asyncio==0.21.1" - pip install "boto3==1.42.80" - pip install "httpx==0.27.0" - pip install "claude-agent-sdk" - pip install -r requirements.txt + curl -LsSf https://astral.sh/uv/0.10.9/install.sh | env UV_NO_MODIFY_PATH=1 sh + export PATH="$HOME/.local/bin:$PATH" + if [ -f "$HOME/miniconda/etc/profile.d/conda.sh" ]; then + export PATH="$HOME/miniconda/bin:$PATH" + source "$HOME/miniconda/etc/profile.d/conda.sh" + conda activate myenv + fi + uv sync --frozen --all-groups --all-extras --python "$(which python)" - run: name: Install dockerize command: | @@ -2861,7 +2707,7 @@ jobs: export LITELLM_API_KEY="sk-1234" pwd ls - python -m pytest -vv tests/proxy_e2e_anthropic_messages_tests/ -x -s --junitxml=test-results/junit.xml --durations=5 + uv run --no-sync python -m pytest -vv tests/proxy_e2e_anthropic_messages_tests/ -x -s --junitxml=test-results/junit.xml --durations=5 no_output_timeout: 15m # Store test results @@ -2894,12 +2740,8 @@ jobs: conda activate myenv python --version - run: - name: Install Poetry - command: | - export PATH="$HOME/miniconda/bin:$PATH" - source $HOME/miniconda/etc/profile.d/conda.sh - conda activate myenv - pip install poetry + name: Prepare uv + command: true - run: name: Install dockerize command: | @@ -2927,26 +2769,24 @@ jobs: - run: name: Install Dependencies command: | - export PATH="$HOME/miniconda/bin:$PATH" - source $HOME/miniconda/etc/profile.d/conda.sh - conda activate myenv - poetry config virtualenvs.in-project true - poetry install --with dev,proxy-dev --extras "proxy" - poetry run pip install psycopg2-binary uvicorn fastapi httpx tenacity + curl -LsSf https://astral.sh/uv/0.10.9/install.sh | env UV_NO_MODIFY_PATH=1 sh + export PATH="$HOME/.local/bin:$PATH" + if [ -f "$HOME/miniconda/etc/profile.d/conda.sh" ]; then + export PATH="$HOME/miniconda/bin:$PATH" + source "$HOME/miniconda/etc/profile.d/conda.sh" + conda activate myenv + fi + uv sync --frozen --all-groups --all-extras --python "$(which python)" - run: name: Setup litellm-enterprise - command: | - export PATH="$HOME/miniconda/bin:$PATH" - source $HOME/miniconda/etc/profile.d/conda.sh - conda activate myenv - poetry run pip install --force-reinstall --no-deps -e enterprise/ + command: true - run: name: Generate Prisma client command: | export PATH="$HOME/miniconda/bin:$PATH" source $HOME/miniconda/etc/profile.d/conda.sh conda activate myenv - poetry run prisma generate --schema litellm/proxy/schema.prisma + uv run --no-sync prisma generate --schema litellm/proxy/schema.prisma - run: name: Run Prisma migrations command: | @@ -2955,7 +2795,7 @@ jobs: conda activate myenv export DATABASE_URL=postgresql://llmproxy:dbpassword9090@localhost:5432/litellm cd litellm/proxy - poetry run prisma migrate deploy --schema schema.prisma + uv run --no-sync prisma migrate deploy --schema schema.prisma cd ../.. - run: name: Run Azure Batch E2E Tests @@ -2968,7 +2808,7 @@ jobs: export USE_MOCK_MODELS=true export USE_STATE_TRACKER=true export LITELLM_LOG=DEBUG - poetry run pytest tests/proxy_e2e_azure_batches_tests/test_proxy_e2e_azure_batches.py \ + uv run --no-sync pytest tests/proxy_e2e_azure_batches_tests/test_proxy_e2e_azure_batches.py \ -vv -s -k "test_e2e_managed_batch" \ --tb=short \ --maxfail=3 \ @@ -2994,17 +2834,16 @@ jobs: - run: name: Combine Coverage command: | - python -m venv venv - . venv/bin/activate - pip install coverage - coverage combine realtime_translation_coverage ocr_coverage search_coverage mcp_coverage litellm_mcps_tests_coverage logging_coverage audio_coverage local_testing_part1_coverage local_testing_part2_coverage pass_through_unit_tests_coverage batches_coverage guardrails_coverage - coverage xml + curl -LsSf https://astral.sh/uv/0.10.9/install.sh | env UV_NO_MODIFY_PATH=1 sh + export PATH="$HOME/.local/bin:$PATH" + uv run --with 'coverage[toml]==7.10.6' coverage combine realtime_translation_coverage ocr_coverage search_coverage mcp_coverage litellm_mcps_tests_coverage logging_coverage audio_coverage local_testing_part1_coverage local_testing_part2_coverage pass_through_unit_tests_coverage batches_coverage guardrails_coverage + uv run --with 'coverage[toml]==7.10.6' coverage xml - codecov/upload: file: ./coverage.xml publish_proxy_extras: docker: - - image: cimg/python:3.8 + - image: cimg/python:3.12 working_directory: ~/project/litellm-proxy-extras environment: TWINE_USERNAME: __token__ @@ -3016,10 +2855,17 @@ jobs: - run: name: Check if litellm-proxy-extras dir or pyproject.toml was modified command: | - echo "Install TOML package." - python -m pip install toml + curl -LsSf https://astral.sh/uv/0.10.9/install.sh | env UV_NO_MODIFY_PATH=1 sh + echo 'export PATH="$HOME/.local/bin:$PATH"' >> "$BASH_ENV" + export PATH="$HOME/.local/bin:$PATH" # Get current version from pyproject.toml - CURRENT_VERSION=$(python -c "import toml; print(toml.load('pyproject.toml')['tool']['poetry']['version'])") + CURRENT_VERSION=$(python - <<'PY' + import tomllib + from pathlib import Path + data = tomllib.loads(Path("pyproject.toml").read_text()) + print(data["project"]["version"]) + PY + ) # Get last published version from PyPI LAST_VERSION=$(curl -s https://pypi.org/pypi/litellm-proxy-extras/json | python -c "import json, sys; print(json.load(sys.stdin)['info']['version'])") @@ -3028,7 +2874,7 @@ jobs: echo "Last published version: $LAST_VERSION" # Compare versions using Python's packaging.version - VERSION_COMPARE=$(python -c "from packaging import version; print(1 if version.parse('$CURRENT_VERSION') < version.parse('$LAST_VERSION') else 0)") + VERSION_COMPARE=$(uv run --with 'packaging==25.0' python -c "from packaging import version; print(1 if version.parse('$CURRENT_VERSION') < version.parse('$LAST_VERSION') else 0)") echo "Version compare: $VERSION_COMPARE" if [ "$VERSION_COMPARE" = "1" ]; then @@ -3036,38 +2882,25 @@ jobs: exit 1 fi - # If versions are equal or current is greater, check contents - pip download --no-deps litellm-proxy-extras==$LAST_VERSION -d /tmp - - echo "Contents of /tmp directory:" - ls -la /tmp - - # Find the downloaded file (could be .whl or .tar.gz) - DOWNLOADED_FILE=$(ls /tmp/litellm_proxy_extras-*) - echo "Downloaded file: $DOWNLOADED_FILE" - - # Extract based on file extension - if [[ "$DOWNLOADED_FILE" == *.whl ]]; then - echo "Extracting wheel file..." - unzip -q "$DOWNLOADED_FILE" -d /tmp/extracted - EXTRACTED_DIR="/tmp/extracted" - else - echo "Extracting tar.gz file..." - tar -xzf "$DOWNLOADED_FILE" -C /tmp - EXTRACTED_DIR="/tmp/litellm_proxy_extras-$LAST_VERSION" - fi - - echo "Contents of extracted package:" - ls -R "$EXTRACTED_DIR" + # If versions are equal or current is greater, compare against the published package contents. + EXTRACTED_DIR=$(uv run --with "litellm-proxy-extras==$LAST_VERSION" python - <<'PY' + import importlib.util + from pathlib import Path + spec = importlib.util.find_spec("litellm_proxy_extras") + if spec is None or spec.origin is None: + raise SystemExit("litellm_proxy_extras not found in uv-run environment") + print(Path(spec.origin).resolve().parent) + PY + ) # Compare contents - if ! diff -r "$EXTRACTED_DIR/litellm_proxy_extras" ./litellm_proxy_extras; then + if ! diff -r "$EXTRACTED_DIR" ./litellm_proxy_extras; then if [ "$CURRENT_VERSION" = "$LAST_VERSION" ]; then echo "Error: Changes detected in litellm-proxy-extras but version was not bumped" echo "Current version: $CURRENT_VERSION" echo "Last published version: $LAST_VERSION" echo "Changes:" - diff -r "$EXTRACTED_DIR/litellm_proxy_extras" ./litellm_proxy_extras + diff -r "$EXTRACTED_DIR" ./litellm_proxy_extras exit 1 fi else @@ -3078,7 +2911,13 @@ jobs: - run: name: Get new version command: | - NEW_VERSION=$(python -c "import toml; print(toml.load('pyproject.toml')['tool']['poetry']['version'])") + NEW_VERSION=$(python - <<'PY' + import tomllib + from pathlib import Path + data = tomllib.loads(Path("pyproject.toml").read_text()) + print(data["project"]["version"]) + PY + ) echo "export NEW_VERSION=$NEW_VERSION" >> $BASH_ENV - run: @@ -3086,27 +2925,35 @@ jobs: command: | cd ~/project # Check pyproject.toml - CURRENT_VERSION=$(python -c "import toml; dep = toml.load('pyproject.toml')['tool']['poetry']['dependencies']['litellm-proxy-extras']; print(dep['version'] if isinstance(dep, dict) else dep)") + CURRENT_VERSION=$(uv run --with 'packaging==25.0' python - <<'PY' + import tomllib + from packaging.requirements import Requirement + from pathlib import Path + data = tomllib.loads(Path("pyproject.toml").read_text()) + for requirement in data["project"]["optional-dependencies"]["proxy"]: + parsed = Requirement(requirement) + if parsed.name == "litellm-proxy-extras" and parsed.specifier: + versions = [spec.version for spec in parsed.specifier if spec.operator == "=="] + if versions: + print(versions[0]) + break + else: + raise SystemExit("Could not find exact litellm-proxy-extras pin in project.optional-dependencies.proxy") + PY + ) if [ "$CURRENT_VERSION" != "$NEW_VERSION" ]; then echo "Error: Version in pyproject.toml ($CURRENT_VERSION) doesn't match new version ($NEW_VERSION)" exit 1 fi - # Check requirements.txt - REQ_VERSION=$(grep -oP 'litellm-proxy-extras==\K[0-9.]+' requirements.txt) - if [ "$REQ_VERSION" != "$NEW_VERSION" ]; then - echo "Error: Version in requirements.txt ($REQ_VERSION) doesn't match new version ($NEW_VERSION)" - exit 1 - fi - - run: name: Publish to PyPI command: | echo -e "[pypi]\nusername = $PYPI_PUBLISH_USERNAME\npassword = $PYPI_PUBLISH_PASSWORD" > ~/.pypirc - python -m pip install --upgrade pip build twine setuptools wheel + export PATH="$HOME/.local/bin:$PATH" rm -rf build dist - python -m build - twine upload --verbose dist/* + uv build + uv tool run --from 'twine==6.2.0' twine upload --verbose dist/* ui_build: docker: @@ -3228,7 +3075,14 @@ jobs: - run: name: Install Dependencies command: | - npm install -D @playwright/test + curl -LsSf https://astral.sh/uv/0.10.9/install.sh | env UV_NO_MODIFY_PATH=1 sh + export PATH="$HOME/.local/bin:$PATH" + if [ -f "$HOME/miniconda/etc/profile.d/conda.sh" ]; then + export PATH="$HOME/miniconda/bin:$PATH" + source "$HOME/miniconda/etc/profile.d/conda.sh" + conda activate myenv + fi + uv sync --frozen --all-groups --all-extras --python "$(which python)" - run: name: Install Playwright Browsers command: | diff --git a/.circleci/requirements.txt b/.circleci/requirements.txt deleted file mode 100644 index be12ab2d0f1..00000000000 --- a/.circleci/requirements.txt +++ /dev/null @@ -1,21 +0,0 @@ -# used by CI/CD testing -openai==1.100.1 -python-dotenv -tiktoken -importlib_metadata -cohere -redis==5.2.1 -redisvl==0.4.1 -anthropic -orjson==3.10.15 # fast /embedding responses -pydantic==2.12.5 -google-cloud-aiplatform==1.133.0 -google-cloud-iam==2.19.1 -fastapi-sso==0.16.0 -uvloop==0.21.0 -mcp==1.26.0 # for MCP server -semantic_router==0.1.10 # for auto-routing with litellm -fastuuid==0.14.0 -responses==0.25.7 # for proxy client tests -pytest-retry==1.6.3 # for automatic test retries -litellm-proxy-extras # for prisma migrations \ No newline at end of file diff --git a/.devcontainer/post-create.sh b/.devcontainer/post-create.sh index 484baa9041d..78f857d55d6 100644 --- a/.devcontainer/post-create.sh +++ b/.devcontainer/post-create.sh @@ -1,17 +1,17 @@ #!/usr/bin/env bash set -e -echo "[post-create] Installing poetry via pip" -python -m pip install --upgrade pip -python -m pip install poetry +echo "[post-create] Installing uv" +curl -LsSf https://astral.sh/uv/0.10.9/install.sh | env UV_NO_MODIFY_PATH=1 sh +export PATH="$HOME/.local/bin:$PATH" -echo "[post-create] Installing Python dependencies (poetry)" -poetry install --with dev --extras proxy +echo "[post-create] Installing Python dependencies (uv)" +uv sync --frozen --group proxy-dev --extra proxy echo "[post-create] Generating Prisma client" -poetry run prisma generate +uv run --no-sync prisma generate echo "[post-create] Installing npm dependencies" cd ui/litellm-dashboard && npm ci -echo "[post-create] Done" \ No newline at end of file +echo "[post-create] Done" diff --git a/.github/workflows/_test-unit-base.yml b/.github/workflows/_test-unit-base.yml index f1ae30e67d7..ed841cd1566 100644 --- a/.github/workflows/_test-unit-base.yml +++ b/.github/workflows/_test-unit-base.yml @@ -47,37 +47,28 @@ jobs: with: python-version: "3.12" - - name: Install Poetry - run: pip install 'poetry==2.3.2' + - name: Set up uv + uses: astral-sh/setup-uv@v7 - - name: Cache Poetry dependencies + - name: Cache uv dependencies uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 with: path: | - ~/.cache/pypoetry - ~/.cache/pip + ~/.cache/uv .venv - key: ${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }} + key: ${{ runner.os }}-uv-${{ hashFiles('uv.lock') }} restore-keys: | - ${{ runner.os }}-poetry- + ${{ runner.os }}-uv- - name: Install dependencies run: | - poetry config virtualenvs.in-project true - poetry install --with dev,proxy-dev --extras "proxy semantic-router" - poetry run pip install google-genai==1.22.0 \ - google-cloud-aiplatform==1.115.0 fastapi-offline==1.7.3 python-multipart==0.0.22 openapi-core==0.23.0 - - - name: Setup litellm-enterprise - run: | - poetry run pip install --force-reinstall --no-deps -e enterprise/ + uv sync --frozen --group ci --group proxy-dev --extra google --extra proxy --extra semantic-router - name: Generate Prisma client env: PRISMA_BINARY_CACHE_DIR: ${{ runner.temp }}/prisma-cache run: | - poetry run pip install nodejs-wheel-binaries==24.13.1 - poetry run prisma generate --schema litellm/proxy/schema.prisma + uv run --no-sync prisma generate --schema litellm/proxy/schema.prisma - name: Run tests env: @@ -86,7 +77,7 @@ jobs: WORKERS: ${{ inputs.workers }} RERUNS: ${{ inputs.reruns }} run: | - poetry run pytest ${TEST_PATH:?} \ + uv run --no-sync pytest ${TEST_PATH:?} \ --tb=short -vv \ --maxfail="${MAX_FAILURES}" \ -n "${WORKERS}" \ diff --git a/.github/workflows/_test-unit-services-base.yml b/.github/workflows/_test-unit-services-base.yml index d53a9e8822a..8d699efbf42 100644 --- a/.github/workflows/_test-unit-services-base.yml +++ b/.github/workflows/_test-unit-services-base.yml @@ -95,44 +95,35 @@ jobs: with: python-version: "3.12" - - name: Install Poetry - run: pip install 'poetry==2.3.2' + - name: Set up uv + uses: astral-sh/setup-uv@v7 - - name: Cache Poetry dependencies + - name: Cache uv dependencies uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 with: path: | - ~/.cache/pypoetry - ~/.cache/pip + ~/.cache/uv .venv - key: ${{ runner.os }}-poetry-services-${{ hashFiles('poetry.lock') }} + key: ${{ runner.os }}-uv-services-${{ hashFiles('uv.lock') }} restore-keys: | - ${{ runner.os }}-poetry-services- + ${{ runner.os }}-uv-services- - name: Install dependencies run: | - poetry config virtualenvs.in-project true - poetry install --with dev,proxy-dev --extras "proxy semantic-router" - poetry run pip install google-genai==1.22.0 \ - google-cloud-aiplatform==1.115.0 fastapi-offline==1.7.3 python-multipart==0.0.22 openapi-core==0.23.0 - - - name: Setup litellm-enterprise - run: | - poetry run pip install --force-reinstall --no-deps -e enterprise/ + uv sync --frozen --group ci --group proxy-dev --extra google --extra proxy --extra semantic-router - name: Generate Prisma client env: PRISMA_BINARY_CACHE_DIR: ${{ runner.temp }}/prisma-cache run: | - poetry run pip install nodejs-wheel-binaries==24.13.1 - poetry run prisma generate --schema litellm/proxy/schema.prisma + uv run --no-sync prisma generate --schema litellm/proxy/schema.prisma - name: Run Prisma migrations if: ${{ inputs.enable-postgres }} env: DATABASE_URL: ${{ secrets.DATABASE_URL }} run: | - poetry run prisma db push --schema litellm/proxy/schema.prisma --accept-data-loss + uv run --no-sync prisma db push --schema litellm/proxy/schema.prisma --accept-data-loss - name: Run tests env: @@ -146,14 +137,14 @@ jobs: REDIS_PASSWORD: ${{ inputs.enable-redis && secrets.REDIS_PASSWORD || '' }} run: | if [ "${WORKERS}" = "0" ]; then - poetry run pytest ${TEST_PATH:?} \ + uv run --no-sync pytest ${TEST_PATH:?} \ --tb=short -vv \ --maxfail="${MAX_FAILURES}" \ --reruns "${RERUNS}" \ --reruns-delay 1 \ --durations=20 else - poetry run pytest ${TEST_PATH:?} \ + uv run --no-sync pytest ${TEST_PATH:?} \ --tb=short -vv \ --maxfail="${MAX_FAILURES}" \ -n "${WORKERS}" \ diff --git a/.github/workflows/auto_update_price_and_context_window.yml b/.github/workflows/auto_update_price_and_context_window.yml index 60e89936219..fc7c4886a78 100644 --- a/.github/workflows/auto_update_price_and_context_window.yml +++ b/.github/workflows/auto_update_price_and_context_window.yml @@ -17,12 +17,11 @@ jobs: - uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0 with: persist-credentials: false - - name: Install Dependencies - run: | - pip install 'aiohttp==3.13.3' + - name: Set up uv + uses: astral-sh/setup-uv@v7 - name: Update JSON Data run: | - python ".github/workflows/auto_update_price_and_context_window_file.py" + uv run --frozen --with 'aiohttp==3.13.3' python ".github/workflows/auto_update_price_and_context_window_file.py" - name: Create Pull Request run: | git add model_prices_and_context_window.json diff --git a/.github/workflows/codspeed.yml b/.github/workflows/codspeed.yml index 52d64addea9..83f7387ac67 100644 --- a/.github/workflows/codspeed.yml +++ b/.github/workflows/codspeed.yml @@ -34,13 +34,11 @@ jobs: with: python-version: "3.12" - - name: Install dependencies - run: | - pip install -e "." - pip install pytest pytest-codspeed==4.3.0 + - name: Set up uv + uses: astral-sh/setup-uv@v7 - name: Run benchmarks uses: CodSpeedHQ/action@1c8ae4843586d3ba879736b7f6b7b0c990757fab # v4.12.1 with: mode: simulation - run: pytest tests/benchmarks/ --codspeed + run: uv run --frozen --group ci pytest tests/benchmarks/ --codspeed diff --git a/.github/workflows/llm-translation-testing.yml b/.github/workflows/llm-translation-testing.yml index 922013c4b54..10385ac8394 100644 --- a/.github/workflows/llm-translation-testing.yml +++ b/.github/workflows/llm-translation-testing.yml @@ -31,26 +31,22 @@ jobs: with: python-version: "3.11" - - name: Install Poetry - run: | - pip install 'poetry==2.3.2' - poetry config virtualenvs.create true - poetry config virtualenvs.in-project true + - name: Set up uv + uses: astral-sh/setup-uv@v7 - - name: Restore Poetry dependencies cache - uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.0.0 + - name: Cache uv dependencies + uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 with: path: | - ~/.cache/pypoetry + ~/.cache/uv .venv - key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }} + key: ${{ runner.os }}-uv-${{ hashFiles('uv.lock') }} restore-keys: | - ${{ runner.os }}-poetry- + ${{ runner.os }}-uv- - name: Install dependencies run: | - poetry install --with dev - poetry run pip install 'pytest-xdist==3.8.0' 'pytest-timeout==2.4.0' + uv sync --frozen - name: Create test results directory run: mkdir -p test-results diff --git a/.github/workflows/publish_to_pypi.yml b/.github/workflows/publish_to_pypi.yml index 8f675bb3075..7da6b2b8b92 100644 --- a/.github/workflows/publish_to_pypi.yml +++ b/.github/workflows/publish_to_pypi.yml @@ -24,10 +24,19 @@ jobs: with: python-version: "3.12" + - name: Set up uv + uses: astral-sh/setup-uv@v7 + - name: Check litellm version on PyPI id: check-litellm run: | - VERSION=$(grep -m1 '^version' pyproject.toml | sed 's/version = "\(.*\)"/\1/') + VERSION=$(python - <<'PY' + import tomllib + + with open("pyproject.toml", "rb") as f: + print(tomllib.load(f)["project"]["version"]) + PY + ) echo "version=$VERSION" >> "$GITHUB_OUTPUT" echo "Checking if litellm $VERSION exists on PyPI..." @@ -42,43 +51,41 @@ jobs: - name: Sanity check proxy-extras version run: | - # Read pinned version from requirements.txt - REQ_VERSION=$(grep -oP 'litellm-proxy-extras==\K[0-9.]+' requirements.txt) - if [ -z "$REQ_VERSION" ]; then - echo "::error::Could not find litellm-proxy-extras version in requirements.txt" - exit 1 - fi - echo "requirements.txt pins litellm-proxy-extras==$REQ_VERSION" + # Read pinned version from project optional dependencies + PYPROJECT_VERSION=$(python3 - <<'PY' + import sys + import tomllib + from packaging.requirements import Requirement - # Read pinned version from pyproject.toml dependency - PYPROJECT_VERSION=$(python3 -c " - import re - with open('pyproject.toml') as f: - content = f.read() - match = re.search(r'litellm-proxy-extras\s*=\s*\{version\s*=\s*\"([^\"]+)\"', content) - if match: - print(match.group(1).lstrip('^~>=')) + with open("pyproject.toml", "rb") as f: + proxy_requirements = tomllib.load(f)["project"]["optional-dependencies"]["proxy"] + + for requirement in proxy_requirements: + parsed = Requirement(requirement) + if parsed.name != "litellm-proxy-extras": + continue + specifiers = list(parsed.specifier) + if len(specifiers) == 1 and specifiers[0].operator == "==": + print(specifiers[0].version) + break else: - import sys - print('::error::Could not find litellm-proxy-extras dependency in pyproject.toml', file=sys.stderr) + print( + "::error::Could not find an exact litellm-proxy-extras pin in project.optional-dependencies.proxy", + file=sys.stderr, + ) sys.exit(1) - ") + PY + ) echo "pyproject.toml pins litellm-proxy-extras version: $PYPROJECT_VERSION" - # Check that both pinned versions match - if [ "$REQ_VERSION" != "$PYPROJECT_VERSION" ]; then - echo "::error::Version mismatch: requirements.txt has $REQ_VERSION but pyproject.toml has $PYPROJECT_VERSION" - exit 1 - fi - # Check that the pinned version exists on PyPI - echo "Checking if litellm-proxy-extras $REQ_VERSION exists on PyPI..." - HTTP_STATUS=$(curl -s -o /dev/null -w "%{http_code}" "https://pypi.org/pypi/litellm-proxy-extras/$REQ_VERSION/json") + echo "Checking if litellm-proxy-extras $PYPROJECT_VERSION exists on PyPI..." + HTTP_STATUS=$(curl -s -o /dev/null -w "%{http_code}" "https://pypi.org/pypi/litellm-proxy-extras/$PYPROJECT_VERSION/json") if [ "$HTTP_STATUS" != "200" ]; then - echo "::error::litellm-proxy-extras $REQ_VERSION is not published on PyPI yet. Publish it before releasing litellm." + echo "::error::litellm-proxy-extras $PYPROJECT_VERSION is not published on PyPI yet. Publish it before releasing litellm." exit 1 fi - echo "litellm-proxy-extras $REQ_VERSION exists on PyPI. Sanity check passed." + echo "litellm-proxy-extras $PYPROJECT_VERSION exists on PyPI. Sanity check passed." publish-litellm: name: Publish litellm to PyPI @@ -100,16 +107,16 @@ jobs: with: python-version: "3.12" + - name: Set up uv + uses: astral-sh/setup-uv@v7 + - name: Copy model prices backup run: cp model_prices_and_context_window.json litellm/model_prices_and_context_window_backup.json - - name: Install build tools - run: python -m pip install --upgrade pip build==1.4.2 - - name: Build package run: | rm -rf build dist - python -m build + uv build - name: Verify build artifacts env: @@ -129,8 +136,7 @@ jobs: - name: Validate package metadata run: | - pip install twine==6.2.0 - twine check dist/* + uv tool run --from 'twine==6.2.0' twine check dist/* - name: Publish to PyPI uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0 diff --git a/.github/workflows/run_llm_translation_tests.py b/.github/workflows/run_llm_translation_tests.py index 5b3a4817ecb..3f3a70efe92 100755 --- a/.github/workflows/run_llm_translation_tests.py +++ b/.github/workflows/run_llm_translation_tests.py @@ -325,7 +325,7 @@ def run_tests(test_path: str = "tests/llm_translation/", # Run pytest cmd = [ - "poetry", "run", "pytest", test_path, + "uv", "run", "--no-sync", "pytest", test_path, f"--junitxml={junit_xml}", "-v", "--tb=short", @@ -335,7 +335,7 @@ def run_tests(test_path: str = "tests/llm_translation/", # Add timeout if pytest-timeout is installed try: - subprocess.run(["poetry", "run", "python", "-c", "import pytest_timeout"], + subprocess.run(["uv", "run", "--no-sync", "python", "-c", "import pytest_timeout"], capture_output=True, check=True) cmd.extend(["--timeout=300"]) except: @@ -436,4 +436,4 @@ if __name__ == "__main__": commit=args.commit ) - sys.exit(exit_code) \ No newline at end of file + sys.exit(exit_code) diff --git a/.github/workflows/test-linting.yml b/.github/workflows/test-linting.yml index 5bb85716a17..fdf8d6e9c4e 100644 --- a/.github/workflows/test-linting.yml +++ b/.github/workflows/test-linting.yml @@ -24,26 +24,26 @@ jobs: with: python-version: "3.12" - - name: Install Poetry - run: pip install 'poetry==2.3.2' + - name: Set up uv + uses: astral-sh/setup-uv@v7 - name: Clean Python cache run: | find . -type d -name "__pycache__" -exec rm -rf {} + || true find . -name "*.pyc" -delete || true - - name: Check poetry.lock is up to date + - name: Check uv.lock is up to date run: | - poetry check --lock || (echo "❌ poetry.lock is out of sync with pyproject.toml. Run 'poetry lock' locally and commit the result." && exit 1) + uv lock --check || (echo "❌ uv.lock is out of sync with pyproject.toml. Run 'uv lock' locally and commit the result." && exit 1) - name: Install dependencies run: | - poetry install --with dev + uv sync --frozen - name: Check Black formatting run: | cd litellm - poetry run black --check --exclude '/enterprise/' . + uv run --no-sync black --check --exclude '/enterprise/' . cd .. - name: Debug - Check file state @@ -58,28 +58,28 @@ jobs: - name: Run Ruff linting run: | cd litellm - poetry run ruff check . + uv run --no-sync ruff check . cd .. - name: Print OpenAI version run: | - poetry run python -c "import openai; print(f'OpenAI version: {openai.__version__}')" + uv run --no-sync python -c "import openai; print(f'OpenAI version: {openai.__version__}')" - name: Run MyPy type checking run: | cd litellm - poetry run mypy . + uv run --no-sync mypy . cd .. - name: Check for circular imports run: | cd litellm - poetry run python ../tests/documentation_tests/test_circular_imports.py + uv run --no-sync python ../tests/documentation_tests/test_circular_imports.py cd .. - name: Check import safety run: | - poetry run python -c "from litellm import *" || (echo '🚨 import failed, this means you introduced unprotected imports! 🚨'; exit 1) + uv run --no-sync python -c "from litellm import *" || (echo '🚨 import failed, this means you introduced unprotected imports! 🚨'; exit 1) secret-scan: runs-on: ubuntu-latest @@ -98,18 +98,19 @@ jobs: with: python-version: "3.12" + - name: Set up uv + uses: astral-sh/setup-uv@v7 + - name: Run secret scan test run: | - pip install 'pytest==9.0.2' - pytest tests/litellm/test_no_hardcoded_secrets.py -v + uv run --frozen --with 'pytest==9.0.2' pytest tests/litellm/test_no_hardcoded_secrets.py -v - name: Run ggshield secret scan env: GITGUARDIAN_API_KEY: ${{ secrets.GITGUARDIAN_API_KEY }} run: | if [ -n "$GITGUARDIAN_API_KEY" ]; then - pip install 'ggshield==1.48.0' - ggshield secret scan repo . + uv tool run --from 'ggshield==1.48.0' ggshield secret scan repo . else echo "GITGUARDIAN_API_KEY not set, skipping ggshield scan" fi diff --git a/.github/workflows/test-litellm-matrix.yml b/.github/workflows/test-litellm-matrix.yml index dafabe4d83e..63ee8eb3288 100644 --- a/.github/workflows/test-litellm-matrix.yml +++ b/.github/workflows/test-litellm-matrix.yml @@ -129,42 +129,32 @@ jobs: with: python-version: "3.12" - - name: Install Poetry - run: pip install 'poetry==2.3.2' + - name: Set up uv + uses: astral-sh/setup-uv@v7 - - name: Cache Poetry dependencies + - name: Cache uv dependencies uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.0.0 with: path: | - ~/.cache/pypoetry - ~/.cache/pip + ~/.cache/uv .venv - key: ${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }} + key: ${{ runner.os }}-uv-${{ hashFiles('uv.lock') }} restore-keys: | - ${{ runner.os }}-poetry- + ${{ runner.os }}-uv- - name: Install dependencies run: | - poetry config virtualenvs.in-project true - poetry install --with dev,proxy-dev --extras "proxy semantic-router" - # pytest-rerunfailures and pytest-xdist are in pyproject.toml dev dependencies - poetry run pip install google-genai==1.22.0 \ - google-cloud-aiplatform==1.115.0 fastapi-offline==1.7.3 python-multipart==0.0.22 openapi-core==0.23.0 - - - name: Setup litellm-enterprise - run: | - poetry run pip install --force-reinstall --no-deps -e enterprise/ + uv sync --frozen --group ci --group proxy-dev --extra google --extra proxy --extra semantic-router - name: Generate Prisma client env: PRISMA_BINARY_CACHE_DIR: ${{ runner.temp }}/prisma-cache run: | - poetry run pip install nodejs-wheel-binaries==24.13.1 - poetry run prisma generate --schema litellm/proxy/schema.prisma + uv run --no-sync prisma generate --schema litellm/proxy/schema.prisma - name: Run tests - ${{ matrix.test-group.name }} run: | - poetry run pytest ${{ matrix.test-group.path }} \ + uv run --no-sync pytest ${{ matrix.test-group.path }} \ --tb=short -vv \ --maxfail=10 \ -n ${{ matrix.test-group.workers }} \ diff --git a/.github/workflows/test-litellm.yml b/.github/workflows/test-litellm.yml index 0c040b3ebe7..44e14e5e6e5 100644 --- a/.github/workflows/test-litellm.yml +++ b/.github/workflows/test-litellm.yml @@ -31,23 +31,13 @@ jobs: with: python-version: "3.12" - - name: Install Poetry - run: pip install 'poetry==2.3.2' + - name: Set up uv + uses: astral-sh/setup-uv@v7 - name: Install dependencies run: | - poetry lock - poetry install --with dev,proxy-dev --extras "proxy semantic-router" - poetry run pip install "pytest-retry==1.6.3" - poetry run pip install 'pytest-xdist==3.8.0' - poetry run pip install "google-genai==1.22.0" - poetry run pip install "google-cloud-aiplatform==1.115.0" - poetry run pip install "fastapi-offline==1.7.3" - poetry run pip install "python-multipart==0.0.22" - poetry run pip install "openapi-core==0.23.0" - - name: Setup litellm-enterprise as local package - run: | - poetry run pip install --force-reinstall --no-deps -e enterprise/ + uv lock --check + uv sync --frozen --group ci --group proxy-dev --extra google --extra proxy --extra semantic-router - name: Run tests run: | - poetry run pytest tests/test_litellm --tb=short -vv --maxfail=10 -n 4 --durations=50 + uv run --no-sync pytest tests/test_litellm --tb=short -vv --maxfail=10 -n 4 --durations=50 diff --git a/.github/workflows/test-mcp.yml b/.github/workflows/test-mcp.yml index 1b228ab76bb..8a18e48a7c9 100644 --- a/.github/workflows/test-mcp.yml +++ b/.github/workflows/test-mcp.yml @@ -27,26 +27,14 @@ jobs: with: python-version: "3.12" - - name: Install Poetry - run: pip install 'poetry==2.3.2' + - name: Set up uv + uses: astral-sh/setup-uv@v7 - name: Install dependencies run: | - poetry lock - poetry install --with dev,proxy-dev --extras "proxy semantic-router" - poetry run pip install "pytest==7.3.1" - poetry run pip install "pytest-retry==1.6.3" - poetry run pip install "pytest-cov==5.0.0" - poetry run pip install "pytest-asyncio==0.21.1" - poetry run pip install "respx==0.22.0" - poetry run pip install "pydantic==2.11.0" - poetry run pip install "mcp==1.25.0" - poetry run pip install 'pytest-xdist==3.8.0' - - - name: Setup litellm-enterprise as local package - run: | - poetry run pip install --force-reinstall --no-deps -e enterprise/ + uv lock --check + uv sync --frozen --group proxy-dev --extra proxy --extra semantic-router - name: Run MCP tests run: | - poetry run pytest tests/mcp_tests -x -vv -n 4 --cov=litellm --cov-report=xml --durations=5 + uv run --no-sync pytest tests/mcp_tests -x -vv -n 4 --cov=litellm --cov-report=xml --durations=5 diff --git a/.github/workflows/test-proxy-e2e-azure-batches.yml b/.github/workflows/test-proxy-e2e-azure-batches.yml index 7cbbe0b338f..2fdb720cddb 100644 --- a/.github/workflows/test-proxy-e2e-azure-batches.yml +++ b/.github/workflows/test-proxy-e2e-azure-batches.yml @@ -42,44 +42,36 @@ jobs: with: python-version: "3.12" - - name: Install Poetry - run: pip install 'poetry==2.3.2' + - name: Set up uv + uses: astral-sh/setup-uv@v7 - - name: Cache Poetry dependencies + - name: Cache uv dependencies uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.0.0 with: path: | - ~/.cache/pypoetry - ~/.cache/pip + ~/.cache/uv .venv - key: ${{ runner.os }}-poetry-e2e-batches-${{ hashFiles('poetry.lock') }} + key: ${{ runner.os }}-uv-e2e-batches-${{ hashFiles('uv.lock') }} restore-keys: | - ${{ runner.os }}-poetry-e2e-batches- - ${{ runner.os }}-poetry- + ${{ runner.os }}-uv-e2e-batches- + ${{ runner.os }}-uv- - name: Install dependencies run: | - poetry config virtualenvs.in-project true - poetry install --with dev,proxy-dev --extras "proxy" - poetry run pip install psycopg2-binary==2.9.11 uvicorn==0.42.0 fastapi==0.135.2 httpx==0.28.1 tenacity==9.1.4 - - - name: Setup litellm-enterprise - run: | - poetry run pip install --force-reinstall --no-deps -e enterprise/ + uv sync --frozen --group ci --group proxy-dev --extra proxy - name: Generate Prisma client env: PRISMA_BINARY_CACHE_DIR: ${{ runner.temp }}/prisma-cache run: | - poetry run pip install nodejs-wheel-binaries==24.13.1 - poetry run prisma generate --schema litellm/proxy/schema.prisma + uv run --no-sync prisma generate --schema litellm/proxy/schema.prisma - name: Run Prisma migrations env: DATABASE_URL: postgresql://llmproxy:dbpassword9090@localhost:5432/litellm run: | cd litellm/proxy - poetry run prisma migrate deploy --schema schema.prisma + uv run --no-sync prisma migrate deploy --schema schema.prisma cd ../.. - name: Run Azure Batch E2E Tests @@ -90,7 +82,7 @@ jobs: USE_STATE_TRACKER: "true" LITELLM_LOG: DEBUG run: | - poetry run pytest tests/proxy_e2e_azure_batches_tests/test_proxy_e2e_azure_batches.py \ + uv run --no-sync pytest tests/proxy_e2e_azure_batches_tests/test_proxy_e2e_azure_batches.py \ -vv -s -k "test_e2e_managed_batch" \ --tb=short \ --maxfail=3 \ diff --git a/.github/workflows/test-unit-documentation.yml b/.github/workflows/test-unit-documentation.yml index d8b30de6844..ea70932d5a2 100644 --- a/.github/workflows/test-unit-documentation.yml +++ b/.github/workflows/test-unit-documentation.yml @@ -26,42 +26,33 @@ jobs: with: python-version: "3.12" - - name: Install Poetry - run: pip install 'poetry==2.3.2' + - name: Set up uv + uses: astral-sh/setup-uv@v7 - - name: Cache Poetry dependencies + - name: Cache uv dependencies uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 with: path: | - ~/.cache/pypoetry - ~/.cache/pip + ~/.cache/uv .venv - key: ${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }} + key: ${{ runner.os }}-uv-${{ hashFiles('uv.lock') }} restore-keys: | - ${{ runner.os }}-poetry- + ${{ runner.os }}-uv- - name: Install dependencies run: | - poetry config virtualenvs.in-project true - poetry install --with dev,proxy-dev --extras "proxy semantic-router" - poetry run pip install google-genai==1.22.0 \ - google-cloud-aiplatform==1.115.0 fastapi-offline==1.7.3 python-multipart==0.0.22 openapi-core==0.23.0 - - - name: Setup litellm-enterprise - run: | - poetry run pip install --force-reinstall --no-deps -e enterprise/ + uv sync --frozen --group ci --group proxy-dev --extra google --extra proxy --extra semantic-router - name: Generate Prisma client env: PRISMA_BINARY_CACHE_DIR: ${{ runner.temp }}/prisma-cache run: | - poetry run pip install nodejs-wheel-binaries==24.13.1 - poetry run prisma generate --schema litellm/proxy/schema.prisma + uv run --no-sync prisma generate --schema litellm/proxy/schema.prisma # Run the same documentation tests that CircleCI ran (as direct Python scripts) - name: Run documentation validation tests run: | - poetry run python ./tests/documentation_tests/test_env_keys.py - poetry run python ./tests/documentation_tests/test_router_settings.py - poetry run python ./tests/documentation_tests/test_api_docs.py - poetry run python ./tests/documentation_tests/test_circular_imports.py + uv run --no-sync python ./tests/documentation_tests/test_env_keys.py + uv run --no-sync python ./tests/documentation_tests/test_router_settings.py + uv run --no-sync python ./tests/documentation_tests/test_api_docs.py + uv run --no-sync python ./tests/documentation_tests/test_circular_imports.py diff --git a/.github/workflows/test-unit-proxy-legacy.yml b/.github/workflows/test-unit-proxy-legacy.yml index a9391137263..94a2e523903 100644 --- a/.github/workflows/test-unit-proxy-legacy.yml +++ b/.github/workflows/test-unit-proxy-legacy.yml @@ -50,43 +50,34 @@ jobs: with: python-version: "3.12" - - name: Install Poetry - run: pip install 'poetry==2.3.2' + - name: Set up uv + uses: astral-sh/setup-uv@v7 - - name: Cache Poetry dependencies + - name: Cache uv dependencies uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 with: path: | - ~/.cache/pypoetry - ~/.cache/pip + ~/.cache/uv .venv - key: ${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }} + key: ${{ runner.os }}-uv-${{ hashFiles('uv.lock') }} restore-keys: | - ${{ runner.os }}-poetry- + ${{ runner.os }}-uv- - name: Install dependencies run: | - poetry config virtualenvs.in-project true - poetry install --with dev,proxy-dev --extras "proxy semantic-router" - poetry run pip install google-genai==1.22.0 \ - google-cloud-aiplatform==1.115.0 fastapi-offline==1.7.3 python-multipart==0.0.22 openapi-core==0.23.0 - - - name: Setup litellm-enterprise - run: | - poetry run pip install --force-reinstall --no-deps -e enterprise/ + uv sync --frozen --group ci --group proxy-dev --extra google --extra proxy --extra semantic-router - name: Generate Prisma client env: PRISMA_BINARY_CACHE_DIR: ${{ runner.temp }}/prisma-cache run: | - poetry run pip install nodejs-wheel-binaries==24.13.1 - poetry run prisma generate --schema litellm/proxy/schema.prisma + uv run --no-sync prisma generate --schema litellm/proxy/schema.prisma - name: Run tests - ${{ matrix.test-group.name }} env: TEST_PATH: ${{ matrix.test-group.path }} run: | - poetry run pytest ${TEST_PATH} \ + uv run --no-sync pytest ${TEST_PATH} \ --tb=short -vv \ --maxfail=10 \ -n 2 \ diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 2bc361bc48f..5999a0ae664 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -16,7 +16,7 @@ repos: exclude: ^litellm/__init__.py$ - id: black name: black - entry: poetry run black + entry: uv run --frozen black language: system types: [python] files: (litellm/|litellm_proxy_extras/).*\.py @@ -27,14 +27,14 @@ repos: exclude: ^litellm/tests/|^litellm/proxy/tests/|^litellm/tests/test_litellm/|^tests/test_litellm/|^tests/enterprise/ additional_dependencies: [flake8-print] files: (litellm/|litellm_proxy_extras/|enterprise/).*\.py -- repo: https://github.com/python-poetry/poetry - rev: 1.8.0 - hooks: - - id: poetry-check - files: ^(pyproject.toml|litellm-proxy-extras/pyproject.toml)$ - repo: local hooks: + - id: uv-lock-check + name: uv lock check + entry: uv lock --check + language: system + files: ^(pyproject.toml|enterprise/pyproject.toml|litellm-proxy-extras/pyproject.toml|uv.lock)$ - id: check-files-match name: Check if files match entry: python3 ci_cd/check_files_match.py - language: system \ No newline at end of file + language: system diff --git a/Makefile b/Makefile index 74031f418d6..b6b674ff3b1 100644 --- a/Makefile +++ b/Makefile @@ -15,7 +15,7 @@ help: @echo " make install-proxy-dev - Install proxy development dependencies" @echo " make install-dev-ci - Install dev dependencies (CI-compatible, pins OpenAI)" @echo " make install-proxy-dev-ci - Install proxy dev dependencies (CI-compatible)" - @echo " make install-test-deps - Install test dependencies" + @echo " make install-test-deps - Install the full local test environment" @echo " make install-helm-unittest - Install helm unittest plugin" @echo " make format - Apply Black code formatting" @echo " make format-check - Check Black code formatting (matches CI)" @@ -40,49 +40,44 @@ help: @echo " make test-integration - Run integration tests" @echo " make test-unit-helm - Run helm unit tests" -# Keep PIP simple for edge cases: -PIP := $(shell command -v pip > /dev/null 2>&1 && echo "pip" || echo "python3 -m pip") +UV := uv +UV_RUN := $(UV) run --no-sync # Show info info: - @echo "PIP: $(PIP)" + @echo "UV: $(UV)" # Installation targets install-dev: - poetry install --with dev + $(UV) sync --frozen install-proxy-dev: - poetry install --with dev,proxy-dev --extras proxy + $(UV) sync --frozen --group proxy-dev --extra proxy # CI-compatible installations (matches GitHub workflows exactly) install-dev-ci: - $(PIP) install openai==2.8.0 - poetry install --with dev - $(PIP) install openai==2.8.0 + $(UV) sync --frozen install-proxy-dev-ci: - poetry install --with dev,proxy-dev --extras proxy - $(PIP) install openai==2.8.0 + $(UV) sync --frozen --group proxy-dev --extra proxy install-test-deps: install-proxy-dev - poetry run $(PIP) install "pytest-retry==1.6.3" - poetry run $(PIP) install pytest-xdist - poetry run $(PIP) install openapi-core - cd enterprise && poetry run $(PIP) install -e . && cd .. + $(UV) sync --frozen --all-groups --all-extras + $(UV_RUN) prisma generate --schema litellm/proxy/schema.prisma install-helm-unittest: helm plugin install https://github.com/helm-unittest/helm-unittest --version v0.4.4 || echo "ignore error if plugin exists" # Formatting format: install-dev - cd litellm && poetry run black . && cd .. + cd litellm && $(UV_RUN) black . && cd .. format-check: install-dev - cd litellm && poetry run black --check . && cd .. + cd litellm && $(UV_RUN) black --check . && cd .. # Linting targets lint-ruff: install-dev - cd litellm && poetry run ruff check . && cd .. + cd litellm && $(UV_RUN) ruff check . && cd .. # faster linter for developing ... # inspiration from: @@ -96,37 +91,36 @@ lint-format-changed: install-dev $$start = $$1; $$count = $$2 || 1; $$end = $$start + $$count - 1; \ print "$$file:$$start:1-$$end:999\n"; \ }' | \ - while read range; do \ - file="$${range%%:*}"; \ - lines="$${range#*:}"; \ - echo "Formatting $$file (lines $$lines)"; \ - poetry run ruff format --range "$$lines" "$$file"; \ - done + while read range; do \ + file="$${range%%:*}"; \ + lines="$${range#*:}"; \ + echo "Formatting $$file (lines $$lines)"; \ + $(UV_RUN) ruff format --range "$$lines" "$$file"; \ + done lint-ruff-dev: install-dev @tmpfile=$$(mktemp /tmp/ruff-dev.XXXXXX) && \ cd litellm && \ - (poetry run ruff check . --output-format=pylint || true) > "$$tmpfile" && \ - poetry run diff-quality --violations=pylint "$$tmpfile" --compare-branch=origin/main && \ + ($(UV_RUN) ruff check . --output-format=pylint || true) > "$$tmpfile" && \ + $(UV_RUN) diff-quality --violations=pylint "$$tmpfile" --compare-branch=origin/main && \ cd .. ; \ rm -f "$$tmpfile" lint-ruff-FULL-dev: install-dev @files=$$(git diff --name-only origin/main -- '*.py'); \ - if [ -n "$$files" ]; then echo "$$files" | xargs poetry run ruff check; \ + if [ -n "$$files" ]; then echo "$$files" | xargs $(UV_RUN) ruff check; \ else echo "No changed .py files to check."; fi lint-mypy: install-dev - poetry run $(PIP) install types-requests types-setuptools types-redis types-PyYAML - cd litellm && poetry run mypy . --ignore-missing-imports && cd .. + cd litellm && $(UV_RUN) mypy . --ignore-missing-imports && cd .. lint-black: format-check check-circular-imports: install-dev - cd litellm && poetry run python ../tests/documentation_tests/test_circular_imports.py && cd .. + cd litellm && $(UV_RUN) python ../tests/documentation_tests/test_circular_imports.py && cd .. check-import-safety: install-dev - @poetry run python -c "from litellm import *; print('[from litellm import *] OK! no issues!');" || (echo '🚨 import failed, this means you introduced unprotected imports! 🚨'; exit 1) + @$(UV_RUN) python -c "from litellm import *; print('[from litellm import *] OK! no issues!');" || (echo '🚨 import failed, this means you introduced unprotected imports! 🚨'; exit 1) # Combined linting (matches test-linting.yml workflow) lint: format-check lint-ruff lint-mypy check-circular-imports check-import-safety @@ -135,46 +129,46 @@ lint: format-check lint-ruff lint-mypy check-circular-imports check-import-safet lint-dev: lint-format-changed lint-mypy check-circular-imports check-import-safety # Testing targets -test: - poetry run pytest tests/ +test: install-test-deps + $(UV_RUN) pytest tests/ test-unit: install-test-deps - poetry run pytest tests/test_litellm -x -vv -n 4 + $(UV_RUN) pytest tests/test_litellm -x -vv -n 4 # Matrix test targets (matching CI workflow groups) test-unit-llms: install-test-deps - poetry run pytest tests/test_litellm/llms --tb=short -vv -n 4 --durations=20 + $(UV_RUN) pytest tests/test_litellm/llms --tb=short -vv -n 4 --durations=20 test-unit-proxy-guardrails: install-test-deps - poetry run pytest tests/test_litellm/proxy/guardrails tests/test_litellm/proxy/management_endpoints tests/test_litellm/proxy/management_helpers --tb=short -vv -n 4 --durations=20 + $(UV_RUN) pytest tests/test_litellm/proxy/guardrails tests/test_litellm/proxy/management_endpoints tests/test_litellm/proxy/management_helpers --tb=short -vv -n 4 --durations=20 test-unit-proxy-core: install-test-deps - poetry run pytest tests/test_litellm/proxy/auth tests/test_litellm/proxy/client tests/test_litellm/proxy/db tests/test_litellm/proxy/hooks tests/test_litellm/proxy/policy_engine --tb=short -vv -n 4 --durations=20 + $(UV_RUN) pytest tests/test_litellm/proxy/auth tests/test_litellm/proxy/client tests/test_litellm/proxy/db tests/test_litellm/proxy/hooks tests/test_litellm/proxy/policy_engine --tb=short -vv -n 4 --durations=20 test-unit-proxy-misc: install-test-deps - poetry run pytest tests/test_litellm/proxy/_experimental tests/test_litellm/proxy/agent_endpoints tests/test_litellm/proxy/anthropic_endpoints tests/test_litellm/proxy/common_utils tests/test_litellm/proxy/discovery_endpoints tests/test_litellm/proxy/experimental tests/test_litellm/proxy/google_endpoints tests/test_litellm/proxy/health_endpoints tests/test_litellm/proxy/image_endpoints tests/test_litellm/proxy/middleware tests/test_litellm/proxy/openai_files_endpoint tests/test_litellm/proxy/pass_through_endpoints tests/test_litellm/proxy/prompts tests/test_litellm/proxy/public_endpoints tests/test_litellm/proxy/response_api_endpoints tests/test_litellm/proxy/spend_tracking tests/test_litellm/proxy/ui_crud_endpoints tests/test_litellm/proxy/vector_store_endpoints tests/test_litellm/proxy/test_*.py --tb=short -vv -n 4 --durations=20 + $(UV_RUN) pytest tests/test_litellm/proxy/_experimental tests/test_litellm/proxy/agent_endpoints tests/test_litellm/proxy/anthropic_endpoints tests/test_litellm/proxy/common_utils tests/test_litellm/proxy/discovery_endpoints tests/test_litellm/proxy/experimental tests/test_litellm/proxy/google_endpoints tests/test_litellm/proxy/health_endpoints tests/test_litellm/proxy/image_endpoints tests/test_litellm/proxy/middleware tests/test_litellm/proxy/openai_files_endpoint tests/test_litellm/proxy/pass_through_endpoints tests/test_litellm/proxy/prompts tests/test_litellm/proxy/public_endpoints tests/test_litellm/proxy/response_api_endpoints tests/test_litellm/proxy/spend_tracking tests/test_litellm/proxy/ui_crud_endpoints tests/test_litellm/proxy/vector_store_endpoints tests/test_litellm/proxy/test_*.py --tb=short -vv -n 4 --durations=20 test-unit-integrations: install-test-deps - poetry run pytest tests/test_litellm/integrations --tb=short -vv -n 4 --durations=20 + $(UV_RUN) pytest tests/test_litellm/integrations --tb=short -vv -n 4 --durations=20 test-unit-core-utils: install-test-deps - poetry run pytest tests/test_litellm/litellm_core_utils --tb=short -vv -n 2 --durations=20 + $(UV_RUN) pytest tests/test_litellm/litellm_core_utils --tb=short -vv -n 2 --durations=20 test-unit-other: install-test-deps - poetry run pytest tests/test_litellm/caching tests/test_litellm/responses tests/test_litellm/secret_managers tests/test_litellm/vector_stores tests/test_litellm/a2a_protocol tests/test_litellm/anthropic_interface tests/test_litellm/completion_extras tests/test_litellm/containers tests/test_litellm/enterprise tests/test_litellm/experimental_mcp_client tests/test_litellm/google_genai tests/test_litellm/images tests/test_litellm/interactions tests/test_litellm/passthrough tests/test_litellm/router_strategy tests/test_litellm/router_utils tests/test_litellm/types --tb=short -vv -n 4 --durations=20 + $(UV_RUN) pytest tests/test_litellm/caching tests/test_litellm/responses tests/test_litellm/secret_managers tests/test_litellm/vector_stores tests/test_litellm/a2a_protocol tests/test_litellm/anthropic_interface tests/test_litellm/completion_extras tests/test_litellm/containers tests/test_litellm/enterprise tests/test_litellm/experimental_mcp_client tests/test_litellm/google_genai tests/test_litellm/images tests/test_litellm/interactions tests/test_litellm/passthrough tests/test_litellm/router_strategy tests/test_litellm/router_utils tests/test_litellm/types --tb=short -vv -n 4 --durations=20 test-unit-root: install-test-deps - poetry run pytest tests/test_litellm/test_*.py --tb=short -vv -n 4 --durations=20 + $(UV_RUN) pytest tests/test_litellm/test_*.py --tb=short -vv -n 4 --durations=20 # Proxy unit tests (tests/proxy_unit_tests split alphabetically) test-proxy-unit-a: install-test-deps - poetry run pytest tests/proxy_unit_tests/test_[a-o]*.py --tb=short -vv -n 2 --durations=20 + $(UV_RUN) pytest tests/proxy_unit_tests/test_[a-o]*.py --tb=short -vv -n 2 --durations=20 test-proxy-unit-b: install-test-deps - poetry run pytest tests/proxy_unit_tests/test_[p-z]*.py --tb=short -vv -n 2 --durations=20 + $(UV_RUN) pytest tests/proxy_unit_tests/test_[p-z]*.py --tb=short -vv -n 2 --durations=20 -test-integration: - poetry run pytest tests/ -k "not test_litellm" +test-integration: install-test-deps + $(UV_RUN) pytest tests/ -k "not test_litellm" test-unit-helm: install-helm-unittest helm unittest -f 'tests/*.yaml' deploy/charts/litellm-helm @@ -188,6 +182,6 @@ test-llm-translation-single: install-test-deps @echo "Running single LLM translation test file..." @if [ -z "$(FILE)" ]; then echo "Usage: make test-llm-translation-single FILE=test_filename.py"; exit 1; fi @mkdir -p test-results - poetry run pytest tests/llm_translation/$(FILE) \ + $(UV_RUN) pytest tests/llm_translation/$(FILE) \ --junitxml=test-results/junit.xml \ -v --tb=short --maxfail=100 --timeout=300 diff --git a/ci_cd/publish-proxy-extras.sh b/ci_cd/publish-proxy-extras.sh index 6c83d1f9212..3f23421405e 100644 --- a/ci_cd/publish-proxy-extras.sh +++ b/ci_cd/publish-proxy-extras.sh @@ -10,10 +10,10 @@ cd "$(dirname "$0")/../litellm-proxy-extras" # Build the package echo "📦 Building package..." -poetry build +uv build # Publish to PyPI echo "🌎 Publishing to PyPI..." -poetry publish +uv publish -echo "✅ Done! Package published successfully" \ No newline at end of file +echo "✅ Done! Package published successfully" diff --git a/ci_cd/security_scans.sh b/ci_cd/security_scans.sh index ee33393c8b1..6faa5011fb4 100755 --- a/ci_cd/security_scans.sh +++ b/ci_cd/security_scans.sh @@ -29,8 +29,12 @@ install_grype() { # Function to install ggshield install_ggshield() { echo "Installing ggshield..." - pip3 install --upgrade pip - pip3 install ggshield + if ! command -v uv >/dev/null 2>&1; then + curl -LsSf https://astral.sh/uv/0.10.9/install.sh | env UV_NO_MODIFY_PATH=1 sh + export PATH="$HOME/.local/bin:$PATH" + fi + uv tool install --force ggshield==1.48.0 + export PATH="$(uv tool dir --bin):$PATH" echo "ggshield installed successfully" } @@ -117,7 +121,7 @@ run_grype_scans() { echo "Using locally built image: litellm:latest" # Allowlist of CVEs to be ignored in failure threshold/reporting - # - CVE-2025-8869: Not applicable on Python >=3.13 (PEP 706 implemented); pip fallback unused; no OS-level fix + # - CVE-2025-8869: Not applicable on Python >=3.13 (PEP 706 implemented); legacy installer fallback unused; no OS-level fix # - GHSA-4xh5-x5gv-qwph: GitHub Security Advisory alias for CVE-2025-8869 # - GHSA-5j98-mcp5-4vw2: glob CLI command injection via -c/--cmd; glob CLI is not used in the litellm runtime image, # and the vulnerable versions are pulled in only via OS-level/node tooling outside of our application code diff --git a/scripts/install.sh b/scripts/install.sh index b9912287b70..14ff350454f 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -11,6 +11,7 @@ MIN_PYTHON_MINOR=9 # NOTE: before merging, this must stay as "litellm[proxy]" to install from PyPI. LITELLM_PACKAGE="litellm[proxy]" +UV_VERSION="0.10.9" # ── colours ──────────────────────────────────────────────────────────────── if [ -t 1 ]; then @@ -69,13 +70,26 @@ if [ -z "$PYTHON_BIN" ]; then die "Python ${MIN_PYTHON_MAJOR}.${MIN_PYTHON_MINOR}+ is required but not found. Install it from https://python.org/downloads or via your package manager: macOS: brew install python@3 - Ubuntu: sudo apt install python3 python3-pip" + Ubuntu: sudo apt install python3" fi -# ── pip detection ────────────────────────────────────────────────────────── -if ! "$PYTHON_BIN" -m pip --version >/dev/null 2>&1; then - die "pip is not available. Install it with: - $PYTHON_BIN -m ensurepip --upgrade" +# ── uv detection / install ──────────────────────────────────────────────── +UV_BIN="" +for candidate in uv "$HOME/.local/bin/uv"; do + if command -v "$candidate" >/dev/null 2>&1; then + UV_BIN="$(command -v "$candidate")" + break + elif [ -x "$candidate" ]; then + UV_BIN="$candidate" + break + fi +done + +if [ -z "$UV_BIN" ]; then + header "Installing uv…" + curl -LsSf "https://astral.sh/uv/${UV_VERSION}/install.sh" | env UV_NO_MODIFY_PATH=1 sh \ + || die "uv installation failed. Try manually: curl -LsSf https://astral.sh/uv/${UV_VERSION}/install.sh | sh" + UV_BIN="$HOME/.local/bin/uv" fi # ── install ──────────────────────────────────────────────────────────────── @@ -83,23 +97,15 @@ echo "" header "Installing litellm[proxy]…" echo "" -"$PYTHON_BIN" -m pip install --upgrade "${LITELLM_PACKAGE}" \ - || die "pip install failed. Try manually: $PYTHON_BIN -m pip install '${LITELLM_PACKAGE}'" +"$UV_BIN" tool install --python "$PYTHON_BIN" --force "${LITELLM_PACKAGE}" \ + || die "uv tool install failed. Try manually: $UV_BIN tool install --python '$PYTHON_BIN' '${LITELLM_PACKAGE}'" -# ── find the litellm binary installed by pip for this Python ─────────────── -# sysconfig.get_path('scripts') is where pip puts console scripts — reliable -# even when the Python lives in a libexec/ symlink tree (e.g. Homebrew). -SCRIPTS_DIR="$("$PYTHON_BIN" -c 'import sysconfig; print(sysconfig.get_path("scripts"))')" +# ── find the litellm binary installed by uv tool ─────────────────────────── +SCRIPTS_DIR="$("$UV_BIN" tool dir --bin)" LITELLM_BIN="${SCRIPTS_DIR}/litellm" if [ ! -x "$LITELLM_BIN" ]; then - # Fall back to user-base bin (pip install --user) - USER_BIN="$("$PYTHON_BIN" -c 'import site; print(site.getuserbase())')/bin" - LITELLM_BIN="${USER_BIN}/litellm" -fi - -if [ ! -x "$LITELLM_BIN" ]; then - die "litellm binary not found after install. Try: $PYTHON_BIN -m pip install --user '${LITELLM_PACKAGE}'" + die "litellm binary not found after install. Try: $UV_BIN tool install --python '$PYTHON_BIN' '${LITELLM_PACKAGE}'" fi # ── success banner ───────────────────────────────────────────────────────── diff --git a/tests/proxy_e2e_azure_batches_tests/validate_e2e_setup.py b/tests/proxy_e2e_azure_batches_tests/validate_e2e_setup.py index e3991f21004..8458f5cb953 100644 --- a/tests/proxy_e2e_azure_batches_tests/validate_e2e_setup.py +++ b/tests/proxy_e2e_azure_batches_tests/validate_e2e_setup.py @@ -68,6 +68,9 @@ def check_database(): return True except Exception as e: print(f" ✗ Database connection failed: {e}") + print(" Install the local test environment first:") + print(" make install-test-deps") + print("") print(" Start PostgreSQL with:") print(" docker run --name litellm-postgres -e POSTGRES_USER=llmproxy \\") print(" -e POSTGRES_PASSWORD=dbpassword9090 -e POSTGRES_DB=litellm \\") @@ -107,8 +110,9 @@ def main(): print("✓ All checks passed! Ready to run E2E tests.") print("\nRun tests with:") print(" cd litellm") + print(" make install-test-deps") print(" export DATABASE_URL='postgresql://llmproxy:dbpassword9090@localhost:5432/litellm'") - print(" poetry run pytest tests/proxy_e2e_azure_batches_tests/test_proxy_e2e_azure_batches.py -vv") + print(" uv run pytest tests/proxy_e2e_azure_batches_tests/test_proxy_e2e_azure_batches.py -vv") return 0 else: print("✗ Some checks failed. Please fix the issues above.")