Skip to content

Commit 3d2b8fe

Browse files
authored
Merge pull request BerriAI#26545 from BerriAI/litellm_internal_staging
[Infra] Promote Internal Staging to main
2 parents 0beec45 + abb63e6 commit 3d2b8fe

2,036 files changed

Lines changed: 18100 additions & 252621 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.circleci/config.yml

Lines changed: 1 addition & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -576,39 +576,6 @@ jobs:
576576
paths:
577577
- realtime_translation_coverage.xml
578578
- realtime_translation_coverage
579-
mcp_testing:
580-
docker:
581-
- *python312_image
582-
working_directory: ~/project
583-
584-
steps:
585-
- checkout
586-
- setup_google_dns
587-
- install_uv
588-
- run:
589-
name: Install Dependencies
590-
command: |
591-
uv sync --frozen --all-groups --all-extras --python 3.12
592-
# Run pytest and generate JUnit XML report
593-
- run:
594-
name: Run tests
595-
command: |
596-
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
597-
no_output_timeout: 15m
598-
- run:
599-
name: Rename the coverage files
600-
command: |
601-
mv coverage.xml mcp_coverage.xml
602-
mv .coverage mcp_coverage
603-
604-
# Store test results
605-
- store_test_results:
606-
path: test-results
607-
- persist_to_workspace:
608-
root: .
609-
paths:
610-
- mcp_coverage.xml
611-
- mcp_coverage
612579
agent_testing:
613580
docker:
614581
- *python312_image
@@ -807,39 +774,6 @@ jobs:
807774
paths:
808775
- search_coverage.xml
809776
- search_coverage
810-
# Split litellm_mapped_tests into parallel jobs
811-
litellm_mapped_tests_proxy_part1:
812-
docker:
813-
- *python312_image
814-
working_directory: ~/project
815-
resource_class: large
816-
steps:
817-
- setup_litellm_test_deps
818-
- run:
819-
name: Run proxy tests part 1 (high-volume directories)
820-
command: |
821-
uv run --no-sync python -m prisma generate
822-
export PYTHONUNBUFFERED=1
823-
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
824-
no_output_timeout: 15m
825-
- store_test_results:
826-
path: test-results
827-
litellm_mapped_tests_proxy_part2:
828-
docker:
829-
- *python312_image
830-
working_directory: ~/project
831-
resource_class: large
832-
steps:
833-
- setup_litellm_test_deps
834-
- run:
835-
name: Run proxy tests part 2 (all other tests)
836-
command: |
837-
uv run --no-sync python -m prisma generate
838-
export PYTHONUNBUFFERED=1
839-
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
840-
no_output_timeout: 15m
841-
- store_test_results:
842-
path: test-results
843777
litellm_mapped_enterprise_tests:
844778
docker:
845779
- *python312_image
@@ -2091,7 +2025,7 @@ jobs:
20912025
- run:
20922026
name: Combine Coverage
20932027
command: |
2094-
uv tool run --from 'coverage[toml]==7.10.6' coverage combine realtime_translation_coverage ocr_coverage search_coverage mcp_coverage logging_coverage audio_coverage local_testing_part1_coverage local_testing_part2_coverage pass_through_unit_tests_coverage batches_coverage guardrails_coverage redis_caching_coverage
2028+
uv tool run --from 'coverage[toml]==7.10.6' coverage combine realtime_translation_coverage ocr_coverage search_coverage logging_coverage audio_coverage local_testing_part1_coverage local_testing_part2_coverage pass_through_unit_tests_coverage batches_coverage guardrails_coverage redis_caching_coverage
20952029
uv tool run --from 'coverage[toml]==7.10.6' coverage xml
20962030
- codecov/upload:
20972031
file: ./coverage.xml
@@ -2426,8 +2360,6 @@ workflows:
24262360
filters: *main_branches
24272361
- realtime_translation_testing:
24282362
filters: *main_branches
2429-
- mcp_testing:
2430-
filters: *main_branches
24312363
- agent_testing:
24322364
filters: *main_branches
24332365
- guardrails_testing:
@@ -2442,10 +2374,6 @@ workflows:
24422374
filters: *main_branches
24432375
- litellm_mapped_enterprise_tests:
24442376
filters: *main_branches
2445-
- litellm_mapped_tests_proxy_part1:
2446-
filters: *main_branches
2447-
- litellm_mapped_tests_proxy_part2:
2448-
filters: *main_branches
24492377
- batches_testing:
24502378
filters: *main_branches
24512379
- litellm_utils_testing:
@@ -2463,14 +2391,11 @@ workflows:
24632391
- upload-coverage:
24642392
requires:
24652393
- realtime_translation_testing
2466-
- mcp_testing
24672394
- agent_testing
24682395
- google_generate_content_endpoint_testing
24692396
- guardrails_testing
24702397
- ocr_testing
24712398
- search_testing
2472-
- litellm_mapped_tests_proxy_part1
2473-
- litellm_mapped_tests_proxy_part2
24742399
- litellm_mapped_enterprise_tests
24752400
- batches_testing
24762401
- litellm_utils_testing
95.8 KB
Loading
103 KB
Loading
123 KB
Loading
95.2 KB
Loading

.github/workflows/_test-unit-services-base.yml

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -32,41 +32,39 @@ on:
3232
required: false
3333
type: boolean
3434
default: false
35+
dist:
36+
description: "pytest-xdist distribution mode (loadscope|load|worksteal|loadfile|no)"
37+
required: false
38+
type: string
39+
default: "loadscope"
3540
artifact-name:
3641
description: "Unique name for the coverage artifact (must be unique per run)"
3742
required: false
3843
type: string
3944
default: "run"
40-
secrets:
41-
DATABASE_URL:
42-
required: false
43-
POSTGRES_USER:
44-
required: false
45-
POSTGRES_PASSWORD:
46-
required: false
4745

4846
permissions:
4947
contents: read
5048

49+
# The postgres service container below is spawned per-job on localhost and
50+
# destroyed with the job. Nothing outside the runner can reach it. The
51+
# user/password/database here are not secrets — they're bootstrap values
52+
# for a throwaway container — so we hardcode them instead of attaching
53+
# every matrix shard to a GHA environment just to read three "secrets"
54+
# (which also produces a "temporarily deployed to …" notification on the
55+
# PR timeline per shard per push).
5156
jobs:
5257
run:
5358
name: Run tests
5459
runs-on: ubuntu-latest
5560
timeout-minutes: ${{ inputs.timeout-minutes }}
56-
# Environment is derived from the enable-* flags, not caller-controllable.
57-
# This prevents callers from passing arbitrary environment names to bypass secret scoping.
58-
environment: >-
59-
${{
60-
inputs.enable-postgres && 'integration-postgres' ||
61-
''
62-
}}
6361

6462
services:
6563
postgres:
6664
image: postgres@sha256:705a5d5b5836f3fcba0d02c4d281e6a7dd9ed2dd4078640f08a1e1e9896e097d # postgres:14
6765
env:
68-
POSTGRES_USER: ${{ secrets.POSTGRES_USER }}
69-
POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }}
66+
POSTGRES_USER: litellm
67+
POSTGRES_PASSWORD: litellm
7068
POSTGRES_DB: litellm_test
7169
ports:
7270
- 5432:5432
@@ -114,7 +112,7 @@ jobs:
114112
- name: Run Prisma migrations
115113
if: ${{ inputs.enable-postgres }}
116114
env:
117-
DATABASE_URL: ${{ secrets.DATABASE_URL }}
115+
DATABASE_URL: "postgresql://litellm:litellm@localhost:5432/litellm_test"
118116
run: |
119117
uv run --no-sync prisma db push --schema litellm/proxy/schema.prisma --accept-data-loss
120118
@@ -124,7 +122,8 @@ jobs:
124122
MAX_FAILURES: ${{ inputs.max-failures }}
125123
WORKERS: ${{ inputs.workers }}
126124
RERUNS: ${{ inputs.reruns }}
127-
DATABASE_URL: ${{ inputs.enable-postgres && secrets.DATABASE_URL || '' }}
125+
DIST: ${{ inputs.dist }}
126+
DATABASE_URL: ${{ inputs.enable-postgres && 'postgresql://litellm:litellm@localhost:5432/litellm_test' || '' }}
128127
run: |
129128
if [ "${WORKERS}" = "0" ]; then
130129
uv run --no-sync pytest ${TEST_PATH:?} \
@@ -143,7 +142,7 @@ jobs:
143142
-n "${WORKERS}" \
144143
--reruns "${RERUNS}" \
145144
--reruns-delay 1 \
146-
--dist=loadscope \
145+
--dist="${DIST}" \
147146
--durations=20 \
148147
--cov=litellm \
149148
--cov-report=xml:coverage.xml \
Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
name: Guard fork dependency changes
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
- litellm_internal_staging
8+
- litellm_oss_branch
9+
- "litellm_**"
10+
paths:
11+
- "uv.lock"
12+
- "pyproject.toml"
13+
- "litellm-proxy-extras/pyproject.toml"
14+
- "enterprise/pyproject.toml"
15+
16+
permissions: {}
17+
18+
jobs:
19+
guard:
20+
name: Block fork dependency changes
21+
runs-on: ubuntu-latest
22+
timeout-minutes: 5
23+
if: github.event.pull_request.head.repo.full_name != github.repository
24+
steps:
25+
- name: Checkout base branch
26+
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
27+
with:
28+
ref: ${{ github.base_ref }}
29+
persist-credentials: false
30+
path: base
31+
32+
- name: Checkout PR head (read-only)
33+
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
34+
with:
35+
persist-credentials: false
36+
path: pr
37+
38+
- name: Reject uv.lock changes
39+
run: |
40+
if ! diff -q base/uv.lock pr/uv.lock >/dev/null 2>&1; then
41+
echo "::error::Fork PRs must not modify uv.lock. Dependency lockfile changes must come from a branch in the canonical repository."
42+
exit 1
43+
fi
44+
echo "uv.lock is unchanged."
45+
46+
- name: Reject new dependencies in pyproject.toml files
47+
shell: bash
48+
run: |
49+
set -euo pipefail
50+
51+
# Write the checker script to a temp file to avoid shell quoting issues.
52+
cat > /tmp/extract_deps.py << 'SCRIPT'
53+
import re
54+
import sys
55+
import tomllib
56+
57+
58+
def normalize(name: str) -> str:
59+
return re.sub(r"[-_.]+", "-", name).lower()
60+
61+
62+
def extract_dep_names(path: str) -> set[str]:
63+
with open(path, "rb") as f:
64+
data = tomllib.load(f)
65+
66+
deps: set[str] = set()
67+
pep508 = re.compile(r"^([A-Za-z0-9](?:[A-Za-z0-9._-]*[A-Za-z0-9])?)")
68+
69+
# [project].dependencies
70+
for spec in data.get("project", {}).get("dependencies", []):
71+
m = pep508.match(spec)
72+
if m:
73+
deps.add(normalize(m.group(1)))
74+
75+
# [project.optional-dependencies]
76+
for group in data.get("project", {}).get("optional-dependencies", {}).values():
77+
for spec in group:
78+
m = pep508.match(spec)
79+
if m:
80+
deps.add(normalize(m.group(1)))
81+
82+
# [dependency-groups]
83+
for group in data.get("dependency-groups", {}).values():
84+
for item in group:
85+
if isinstance(item, str):
86+
m = pep508.match(item)
87+
if m:
88+
deps.add(normalize(m.group(1)))
89+
90+
return deps
91+
92+
93+
if __name__ == "__main__":
94+
for name in sorted(extract_dep_names(sys.argv[1])):
95+
print(name)
96+
SCRIPT
97+
98+
had_error=0
99+
100+
check_deps() {
101+
local base_file="$1"
102+
local pr_file="$2"
103+
local label="$3"
104+
105+
if [ ! -f "$base_file" ] && [ ! -f "$pr_file" ]; then
106+
return 0
107+
fi
108+
109+
if [ ! -f "$base_file" ] && [ -f "$pr_file" ]; then
110+
echo "::error::Fork PR introduces a new $label that does not exist on the base branch."
111+
return 1
112+
fi
113+
114+
base_deps=$(python3 /tmp/extract_deps.py "$base_file")
115+
pr_deps=$(python3 /tmp/extract_deps.py "$pr_file")
116+
117+
new_deps=$(comm -13 <(echo "$base_deps") <(echo "$pr_deps"))
118+
119+
if [ -n "$new_deps" ]; then
120+
echo "::error::Fork PR adds new dependencies in $label: $(echo $new_deps | tr '\n' ', ')"
121+
echo "New packages detected:"
122+
echo "$new_deps"
123+
return 1
124+
fi
125+
126+
echo "$label: no new dependencies."
127+
return 0
128+
}
129+
130+
check_deps base/pyproject.toml pr/pyproject.toml "pyproject.toml" || had_error=1
131+
check_deps base/litellm-proxy-extras/pyproject.toml pr/litellm-proxy-extras/pyproject.toml "litellm-proxy-extras/pyproject.toml" || had_error=1
132+
check_deps base/enterprise/pyproject.toml pr/enterprise/pyproject.toml "enterprise/pyproject.toml" || had_error=1
133+
134+
if [ "$had_error" -ne 0 ]; then
135+
echo ""
136+
echo "::error::Fork PRs must not add new dependencies. Please open an issue or coordinate with a maintainer to update dependencies from within the canonical repository."
137+
exit 1
138+
fi
139+
140+
echo "All pyproject.toml files passed dependency check."

.github/workflows/test-code-quality.yml

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,13 @@ jobs:
2525
with:
2626
persist-credentials: false
2727

28-
- name: Checkout litellm-docs (for documentation_tests)
28+
- name: Checkout litellm-docs into docs/my-website (for documentation_tests)
2929
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
3030
with:
3131
repository: BerriAI/litellm-docs
32-
path: _litellm_docs_checkout
32+
path: docs/my-website
3333
persist-credentials: false
3434

35-
- name: Wire up docs path expected by documentation_tests/*
36-
run: |
37-
# documentation_tests scripts read from docs/my-website/docs/...
38-
# In litellm-docs the same files live at docs/... (repo root).
39-
# Point docs/my-website -> litellm-docs checkout so the paths resolve.
40-
rm -rf docs/my-website
41-
ln -s ../_litellm_docs_checkout docs/my-website
42-
4335
- name: Set up Python
4436
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
4537
with:

0 commit comments

Comments
 (0)