diff --git a/.circleci/config.yml b/.circleci/config.yml index 62c12c1cf9..0adfd5be52 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1785,7 +1785,7 @@ jobs: - audio_coverage installing_litellm_on_python: docker: - - image: circleci/python:3.8 + - image: cimg/python:3.11 auth: username: ${DOCKERHUB_USERNAME} password: ${DOCKERHUB_PASSWORD} @@ -3339,7 +3339,7 @@ jobs: python -m build twine upload --verbose dist/* - e2e_ui_testing: + ui_build: machine: image: ubuntu-2204:2023.10.1 resource_class: xlarge @@ -3366,6 +3366,50 @@ jobs: # Now source the build script source ./build_ui.sh + - persist_to_workspace: + root: . + paths: + - litellm/proxy/_experimental/out + + ui_unit_tests: + machine: + image: ubuntu-2204:2023.10.1 + resource_class: xlarge + working_directory: ~/project + steps: + - checkout + - setup_google_dns + - run: + name: Run UI unit tests (Vitest) + command: | + # Use Node 20 (several deps require >=20) + export NVM_DIR="/opt/circleci/.nvm" + source "$NVM_DIR/nvm.sh" + nvm install 20 + nvm use 20 + + cd ui/litellm-dashboard + # Remove node_modules and package-lock to ensure clean install (fixes optional deps issue) + rm -rf node_modules package-lock.json + npm install + + # CI run, with both LCOV (Codecov) and HTML (artifact you can click) + CI=true npm run test -- --run --coverage \ + --coverage.provider=v8 \ + --coverage.reporter=lcov \ + --coverage.reporter=html \ + --coverage.reportsDirectory=coverage/html + + e2e_ui_testing: + machine: + image: ubuntu-2204:2023.10.1 + resource_class: xlarge + working_directory: ~/project + steps: + - checkout + - setup_google_dns + - attach_workspace: + at: ~/project - run: name: Upgrade Docker to v24.x (API 1.44+) command: | @@ -3411,24 +3455,6 @@ jobs: name: Install Playwright Browsers command: | npx playwright install - - run: - name: Run UI unit tests (Vitest) - command: | - # Use Node 20 (several deps require >=20) - export NVM_DIR="/opt/circleci/.nvm" - source "$NVM_DIR/nvm.sh" - nvm install 20 - nvm use 20 - - cd ui/litellm-dashboard - npm ci || npm install - - # CI run, with both LCOV (Codecov) and HTML (artifact you can click) - CI=true npm run test -- --run --coverage \ - --coverage.provider=v8 \ - --coverage.reporter=lcov \ - --coverage.reporter=html \ - --coverage.reportsDirectory=coverage/html - run: name: Build Docker image @@ -3470,8 +3496,13 @@ jobs: command: | npx playwright test e2e_ui_tests/ --reporter=html --output=test-results no_output_timeout: 120m - - store_test_results: + - store_artifacts: path: test-results + destination: playwright-results + + - store_artifacts: + path: playwright-report + destination: playwright-report test_nonroot_image: machine: @@ -3633,6 +3664,20 @@ workflows: only: - main - /litellm_.*/ + - ui_build: + filters: + branches: + only: + - main + - /litellm_.*/ + - ui_unit_tests: + requires: + - ui_build + filters: + branches: + only: + - main + - /litellm_.*/ - auth_ui_unit_tests: filters: branches: @@ -3640,6 +3685,8 @@ workflows: - main - /litellm_.*/ - e2e_ui_testing: + requires: + - ui_build filters: branches: only: diff --git a/.github/workflows/test-litellm.yml b/.github/workflows/test-litellm.yml index 1d9bd201fa..c7de07aec6 100644 --- a/.github/workflows/test-litellm.yml +++ b/.github/workflows/test-litellm.yml @@ -37,7 +37,7 @@ jobs: - name: Setup litellm-enterprise as local package run: | cd enterprise - python -m pip install -e . + poetry run pip install -e . cd .. - name: Run tests run: | diff --git a/AGENTS.md b/AGENTS.md index 8e7b5f2bd2..2c778dc0d7 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -94,6 +94,29 @@ LiteLLM supports MCP for agent workflows: - Support for external MCP servers (Zapier, Jira, Linear, etc.) - See `litellm/experimental_mcp_client/` and `litellm/proxy/_experimental/mcp_server/` +## RUNNING SCRIPTS + +Use `poetry run python script.py` to run Python scripts in the project environment (for non-test files). + +## GITHUB TEMPLATES + +When opening issues or pull requests, follow these templates: + +### Bug Reports (`.github/ISSUE_TEMPLATE/bug_report.yml`) +- Describe what happened vs. expected behavior +- Include relevant log output +- Specify LiteLLM version +- Indicate if you're part of an ML Ops team (helps with prioritization) + +### Feature Requests (`.github/ISSUE_TEMPLATE/feature_request.yml`) +- Clearly describe the feature +- Explain motivation and use case with concrete examples + +### Pull Requests (`.github/pull_request_template.md`) +- Add at least 1 test in `tests/litellm/` +- Ensure `make test-unit` passes + + ## TESTING CONSIDERATIONS 1. **Provider Tests**: Test against real provider APIs when possible diff --git a/CLAUDE.md b/CLAUDE.md index 50bed6e43e..23a0e97eae 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -25,6 +25,25 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co - `poetry run pytest tests/path/to/test_file.py -v` - Run specific test file - `poetry run pytest tests/path/to/test_file.py::test_function -v` - Run specific test +### Running Scripts +- `poetry run python script.py` - Run Python scripts (use for non-test files) + +### GitHub Issue & PR Templates +When contributing to the project, use the appropriate templates: + +**Bug Reports** (`.github/ISSUE_TEMPLATE/bug_report.yml`): +- Describe what happened vs. what you expected +- Include relevant log output +- Specify your LiteLLM version + +**Feature Requests** (`.github/ISSUE_TEMPLATE/feature_request.yml`): +- Describe the feature clearly +- Explain the motivation and use case + +**Pull Requests** (`.github/pull_request_template.md`): +- Add at least 1 test in `tests/litellm/` +- Ensure `make test-unit` passes + ## Architecture Overview LiteLLM is a unified interface for 100+ LLM providers with two main components: diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3e835809b7..a418c8c57a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -24,8 +24,9 @@ Before contributing code to LiteLLM, you must sign our [Contributor License Agre ### 1. Setup Your Local Development Environment ```bash -# Clone the repository -git clone https://github.com/BerriAI/litellm.git +# Fork the repository on GitHub (click the Fork button at https://github.com/BerriAI/litellm) +# Then clone your fork locally +git clone https://github.com/YOUR_USERNAME/litellm.git cd litellm # Create a new branch for your feature diff --git a/Dockerfile b/Dockerfile index d9ea0d9a47..d8397ec481 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,8 @@ # Base image for building -ARG LITELLM_BUILD_IMAGE=cgr.dev/chainguard/python:latest-dev +ARG LITELLM_BUILD_IMAGE=cgr.dev/chainguard/wolfi-base # Runtime image -ARG LITELLM_RUNTIME_IMAGE=cgr.dev/chainguard/python:latest-dev +ARG LITELLM_RUNTIME_IMAGE=cgr.dev/chainguard/wolfi-base # Builder stage FROM $LITELLM_BUILD_IMAGE AS builder @@ -12,11 +12,9 @@ WORKDIR /app USER root # Install build dependencies -RUN apk add --no-cache gcc python3-dev openssl openssl-dev +RUN apk add --no-cache bash gcc py3-pip python3 python3-dev openssl openssl-dev - -RUN pip install --upgrade pip>=24.3.1 && \ - pip install build +RUN python -m pip install build # Copy the current directory contents into the container at /app COPY . . @@ -48,10 +46,7 @@ FROM $LITELLM_RUNTIME_IMAGE AS runtime USER root # Install runtime dependencies -RUN apk add --no-cache openssl tzdata - -# Upgrade pip to fix CVE-2025-8869 -RUN pip install --upgrade pip>=24.3.1 +RUN apk add --no-cache bash openssl tzdata nodejs npm python3 py3-pip WORKDIR /app # Copy the current directory contents into the container at /app diff --git a/GEMINI.md b/GEMINI.md index efcee04d4c..a9d40c910b 100644 --- a/GEMINI.md +++ b/GEMINI.md @@ -25,6 +25,25 @@ This file provides guidance to Gemini when working with code in this repository. - `poetry run pytest tests/path/to/test_file.py -v` - Run specific test file - `poetry run pytest tests/path/to/test_file.py::test_function -v` - Run specific test +### Running Scripts +- `poetry run python script.py` - Run Python scripts (use for non-test files) + +### GitHub Issue & PR Templates +When contributing to the project, use the appropriate templates: + +**Bug Reports** (`.github/ISSUE_TEMPLATE/bug_report.yml`): +- Describe what happened vs. what you expected +- Include relevant log output +- Specify your LiteLLM version + +**Feature Requests** (`.github/ISSUE_TEMPLATE/feature_request.yml`): +- Describe the feature clearly +- Explain the motivation and use case + +**Pull Requests** (`.github/pull_request_template.md`): +- Add at least 1 test in `tests/litellm/` +- Ensure `make test-unit` passes + ## Architecture Overview LiteLLM is a unified interface for 100+ LLM providers with two main components: diff --git a/Makefile b/Makefile index a79a397f94..1614a58fc7 100644 --- a/Makefile +++ b/Makefile @@ -34,13 +34,13 @@ install-proxy-dev: # CI-compatible installations (matches GitHub workflows exactly) install-dev-ci: - pip install openai==1.99.5 + pip install openai==2.8.0 poetry install --with dev - pip install openai==1.99.5 + pip install openai==2.8.0 install-proxy-dev-ci: poetry install --with dev,proxy-dev --extras proxy - pip install openai==1.99.5 + pip install openai==2.8.0 install-test-deps: install-proxy-dev poetry run pip install "pytest-retry==1.6.3" diff --git a/README.md b/README.md index b29c86a112..9fed1c6dbc 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@
Call all LLM APIs using the OpenAI format [Bedrock, Huggingface, VertexAI, TogetherAI, Azure, OpenAI, Groq etc.]
Hello, world!
-This is a test of the
Hello, world!
-This is a test of the
Hello, world!
-This is a test of the
Hello, world!
-This is a test of the
Hello, world!
+This is a test of the
Hello!
How are you?
Hello!
How are you?
This is a React page
-