mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-12 23:01:41 +00:00
chore: clean up repo root, first safe slice of the src layout migration
Remove files that should never have been at the root: a stale litellm-1.79.1 sdist under dist/ (now gitignored), qa_sticky_session.sh which leaked in with an unrelated commit, and the dead flake8 toolchain (.flake8 plus the dev dependency; ruff replaced it and nothing invokes it), along with the unused [tool.isort] section in pyproject.toml Fold ruff.toml into pyproject.toml [tool.ruff], move codecov.yaml to .github/ and prometheus.yml to docker/, and merge the two divergent license_cache.json copies into tests/code_coverage_tests/ with the cache path resolved relative to check_licenses.py instead of the CWD, which is what created the duplicate in the first place
This commit is contained in:
parent
c370503091
commit
6378f9b470
14 changed files with 110 additions and 239 deletions
46
.flake8
46
.flake8
|
|
@ -1,46 +0,0 @@
|
|||
[flake8]
|
||||
ignore =
|
||||
# The following ignores can be removed when formatting using black
|
||||
W191,W291,W292,W293,W391,W504
|
||||
E101,E111,E114,E116,E117,E121,E122,E123,E124,E125,E126,E127,E128,E129,E131,
|
||||
E201,E202,E221,E222,E225,E226,E231,E241,E251,E252,E261,E265,E271,E272,E275,
|
||||
E301,E302,E303,E305,E306,
|
||||
# line break before binary operator
|
||||
W503,
|
||||
# inline comment should start with '# '
|
||||
E262,
|
||||
# too many leading '#' for block comment
|
||||
E266,
|
||||
# multiple imports on one line
|
||||
E401,
|
||||
# module level import not at top of file
|
||||
E402,
|
||||
# Line too long (82 > 79 characters)
|
||||
E501,
|
||||
# comparison to None should be 'if cond is None:'
|
||||
E711,
|
||||
# comparison to True should be 'if cond is True:' or 'if cond:'
|
||||
E712,
|
||||
# do not compare types, for exact checks use `is` / `is not`, for instance checks use `isinstance()`
|
||||
E721,
|
||||
# do not use bare 'except'
|
||||
E722,
|
||||
# x is imported but unused
|
||||
F401,
|
||||
# 'from . import *' used; unable to detect undefined names
|
||||
F403,
|
||||
# x may be undefined, or defined from star imports:
|
||||
F405,
|
||||
# f-string is missing placeholders
|
||||
F541,
|
||||
# dictionary key '' repeated with different values
|
||||
F601,
|
||||
# redefinition of unused x from line 123
|
||||
F811,
|
||||
# undefined name x
|
||||
F821,
|
||||
# local variable x is assigned to but never used
|
||||
F841,
|
||||
|
||||
# https://black.readthedocs.io/en/stable/guides/using_black_with_other_tools.html#flake8
|
||||
extend-ignore = E203
|
||||
0
codecov.yaml → .github/codecov.yaml
vendored
0
codecov.yaml → .github/codecov.yaml
vendored
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -9,6 +9,7 @@ litellm/proxy/myenv/*
|
|||
litellm_uuid.txt
|
||||
__pycache__/
|
||||
*.pyc
|
||||
/dist/
|
||||
|
||||
# Rust bridge build artifacts (compiled, platform-specific; regenerated by maturin/cargo)
|
||||
litellm/rust_bridge/_native*.so
|
||||
|
|
|
|||
2
Makefile
2
Makefile
|
|
@ -87,7 +87,7 @@ install-hooks:
|
|||
./scripts/install_git_hooks.sh
|
||||
|
||||
# Formatting
|
||||
# Wrap width is ruff.toml's single source of truth (line-length = 120), shared by the
|
||||
# Wrap width is pyproject.toml [tool.ruff]'s single source of truth (line-length = 120), shared by the
|
||||
# formatter and the import sorter so there's no 88-vs-120 split to reconcile.
|
||||
format: install-dev
|
||||
cd litellm && $(UV_RUN) ruff format --exclude '/enterprise/' . && cd ..
|
||||
|
|
|
|||
BIN
dist/litellm-1.79.1.tar.gz
vendored
BIN
dist/litellm-1.79.1.tar.gz
vendored
Binary file not shown.
|
|
@ -57,7 +57,7 @@ services:
|
|||
image: prom/prometheus
|
||||
volumes:
|
||||
- prometheus_data:/prometheus
|
||||
- ./prometheus.yml:/etc/prometheus/prometheus.yml
|
||||
- ./docker/prometheus.yml:/etc/prometheus/prometheus.yml
|
||||
ports:
|
||||
- "9090:9090"
|
||||
command:
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -147,7 +147,6 @@ litellm-proxy = "litellm.proxy.client.cli:cli"
|
|||
[dependency-groups]
|
||||
dev = [
|
||||
"diff-cover==9.7.2",
|
||||
"flake8==7.3.0",
|
||||
"basedpyright==1.39.7",
|
||||
"pytest==9.0.3",
|
||||
"pytest-mock==3.15.1",
|
||||
|
|
@ -270,8 +269,39 @@ source-exclude = [
|
|||
"**/.ruff_cache/**",
|
||||
]
|
||||
|
||||
[tool.isort]
|
||||
profile = "black"
|
||||
[tool.ruff]
|
||||
line-length = 120
|
||||
|
||||
[tool.ruff.lint]
|
||||
ignore = ["F405", "E402", "F403"]
|
||||
extend-select = ["T20", "PGH004", "RUF008", "RUF009", "RUF100"]
|
||||
# RUF100 (unused-noqa) only knows the rules enabled in THIS config, so it would strip
|
||||
# `# noqa` directives that protect rules enforced elsewhere. List those codes as external
|
||||
# so RUF100 leaves their directives alone: the strict gate (ruff-strict.toml) and upstream
|
||||
# litellm's own ruff config both rely on suppressions this config can't see.
|
||||
external = [
|
||||
# Enforced by the strict-rule gate (scripts/ruff_strict_gate.py + ruff-strict.toml)
|
||||
"C901",
|
||||
# Enforced by upstream litellm's ruff config, but not run in this repo's CI
|
||||
"PLC0415", "E402", "BLE001", "ARG002", "S102", "S324", "S606", "D401", "F403", "F405",
|
||||
]
|
||||
# Was the top-level `exclude`. Scoped to lint so `ruff format` still formats these paths
|
||||
# (Black did) while `ruff check` keeps skipping them.
|
||||
exclude = ["litellm/types/*", "litellm/__init__.py", "litellm/proxy/example_config_yaml/*", "tests/*"]
|
||||
|
||||
[tool.ruff.lint.per-file-ignores]
|
||||
"litellm/main.py" = ["F401"]
|
||||
"litellm/utils.py" = ["F401"]
|
||||
"litellm/proxy/proxy_server.py" = ["F401"]
|
||||
"litellm/caching/__init__.py" = ["F401"]
|
||||
"litellm/llms/anthropic/chat/__init__.py" = ["F401"]
|
||||
"litellm/llms/azure_ai/embed/__init__.py" = ["F401"]
|
||||
"litellm/llms/azure_ai/rerank/__init__.py" = ["F401"]
|
||||
"litellm/llms/bedrock/chat/__init__.py" = ["F401"]
|
||||
"litellm/proxy/utils.py" = ["F401"]
|
||||
|
||||
[tool.ruff.format]
|
||||
exclude = ["**/enterprise/**"]
|
||||
|
||||
[tool.commitizen]
|
||||
version = "1.92.0"
|
||||
|
|
|
|||
|
|
@ -1,59 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
# QA: code interpreter sandbox stickiness via metadata.session_id
|
||||
# bash qa_sticky_session.sh
|
||||
# LITELLM_BASE_URL=http://localhost:4000 LITELLM_KEY=sk-1234 bash qa_sticky_session.sh
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
BASE="${LITELLM_BASE_URL:-http://localhost:4000}"
|
||||
KEY="${LITELLM_KEY:-sk-1234}"
|
||||
MODEL="${LITELLM_MODEL:-gpt-4o-mini}"
|
||||
# proxy running at http://localhost:4000 (master key: sk-1234)
|
||||
SESSION_A="qa-session-$(date +%s)-A"
|
||||
SESSION_B="qa-session-$(date +%s)-B"
|
||||
|
||||
content() {
|
||||
echo "$1" | python3 -c "import sys,json; d=json.load(sys.stdin); print(d.get('choices',[{}])[0].get('message',{}).get('content','<error>'))"
|
||||
}
|
||||
|
||||
call() {
|
||||
local session="${1:-}" code="$2" meta=""
|
||||
[[ -n "$session" ]] && meta=", \"metadata\": {\"session_id\": \"$session\"}"
|
||||
curl -s -X POST "$BASE/chat/completions" \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "Authorization: Bearer $KEY" \
|
||||
-d "{\"model\":\"$MODEL\"$meta,\"tools\":[{\"type\":\"code_interpreter\"}],\"messages\":[{\"role\":\"user\",\"content\":\"Run this Python code and tell me the result: $code\"}]}"
|
||||
}
|
||||
|
||||
assert_match() {
|
||||
local label="$1" body="$2" pattern="$3"
|
||||
if echo "$body" | grep -qiE "$pattern"; then
|
||||
echo "PASS $label"
|
||||
else
|
||||
echo "FAIL $label (expected /$pattern/)"
|
||||
echo " $(content "$body")"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
echo "=== Sticky Session Sandbox QA ==="
|
||||
echo "base: $BASE session A: $SESSION_A session B: $SESSION_B"
|
||||
echo
|
||||
|
||||
R=$(call "$SESSION_A" "x = 42; print(x)")
|
||||
assert_match "same session_id reuses sandbox (set x=42)" "$R" "42"
|
||||
|
||||
R=$(call "$SESSION_A" "print(x)")
|
||||
assert_match "same session_id keeps state (x still 42)" "$R" "42"
|
||||
|
||||
R=$(call "$SESSION_B" "print(x)")
|
||||
assert_match "different session_id is isolated" "$R" "not defined|NameError|undefined|error"
|
||||
|
||||
R=$(call "" "y = 99; print(y)")
|
||||
assert_match "no session_id runs code" "$R" "99"
|
||||
|
||||
R=$(call "" "print(y)")
|
||||
assert_match "no session_id gets fresh sandbox each request" "$R" "not defined|NameError|undefined|error"
|
||||
|
||||
echo
|
||||
echo "All checks passed."
|
||||
31
ruff.toml
31
ruff.toml
|
|
@ -1,31 +0,0 @@
|
|||
lint.ignore = ["F405", "E402", "F403"]
|
||||
lint.extend-select = ["T20", "PGH004", "RUF008", "RUF009", "RUF100"]
|
||||
# RUF100 (unused-noqa) only knows the rules enabled in THIS config, so it would strip
|
||||
# `# noqa` directives that protect rules enforced elsewhere. List those codes as external
|
||||
# so RUF100 leaves their directives alone: the strict gate (ruff-strict.toml) and upstream
|
||||
# litellm's own ruff config both rely on suppressions this config can't see.
|
||||
lint.external = [
|
||||
# Enforced by the strict-rule gate (scripts/ruff_strict_gate.py + ruff-strict.toml)
|
||||
"C901",
|
||||
# Enforced by upstream litellm's ruff config, but not run in this repo's CI
|
||||
"PLC0415", "E402", "BLE001", "ARG002", "S102", "S324", "S606", "D401", "F403", "F405",
|
||||
]
|
||||
line-length = 120
|
||||
|
||||
format.exclude = ["**/enterprise/**"]
|
||||
|
||||
# Was the top-level `exclude`. Scoped to lint so `ruff format` still formats these paths
|
||||
# (Black did) while `ruff check` keeps skipping them.
|
||||
lint.exclude = ["litellm/types/*", "litellm/__init__.py", "litellm/proxy/example_config_yaml/*", "tests/*"]
|
||||
|
||||
|
||||
[lint.per-file-ignores]
|
||||
"litellm/main.py" = ["F401"]
|
||||
"litellm/utils.py" = ["F401"]
|
||||
"litellm/proxy/proxy_server.py" = ["F401"]
|
||||
"litellm/caching/__init__.py" = ["F401"]
|
||||
"litellm/llms/anthropic/chat/__init__.py" = ["F401"]
|
||||
"litellm/llms/azure_ai/embed/__init__.py" = ["F401"]
|
||||
"litellm/llms/azure_ai/rerank/__init__.py" = ["F401"]
|
||||
"litellm/llms/bedrock/chat/__init__.py" = ["F401"]
|
||||
"litellm/proxy/utils.py" = ["F401"]
|
||||
|
|
@ -71,7 +71,7 @@ class LicenseChecker:
|
|||
self.authorized_packages = self._parse_authorized_packages()
|
||||
|
||||
# Initialize cache
|
||||
self.cache_file = Path("license_cache.json")
|
||||
self.cache_file = Path(__file__).parent / "license_cache.json"
|
||||
self.license_cache: Dict[str, str] = {}
|
||||
if self.cache_file.exists():
|
||||
with open(self.cache_file) as f:
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
36
uv.lock
generated
36
uv.lock
generated
|
|
@ -9,7 +9,7 @@ resolution-markers = [
|
|||
]
|
||||
|
||||
[options]
|
||||
exclude-newer = "2026-06-27T20:21:25.609736Z"
|
||||
exclude-newer = "2026-06-29T18:30:25.156901464Z"
|
||||
exclude-newer-span = "P3D"
|
||||
|
||||
[manifest]
|
||||
|
|
@ -1624,20 +1624,6 @@ wheels = [
|
|||
{ url = "https://files.pythonhosted.org/packages/81/47/dd9a212ef6e343a6857485ffe25bba537304f1913bdbed446a23f7f592e1/filelock-3.29.0-py3-none-any.whl", hash = "sha256:96f5f6344709aa1572bbf631c640e4ebeeb519e08da902c39a001882f30ac258", size = 39812, upload-time = "2026-04-19T15:39:08.752Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "flake8"
|
||||
version = "7.3.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "mccabe" },
|
||||
{ name = "pycodestyle" },
|
||||
{ name = "pyflakes" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/9b/af/fbfe3c4b5a657d79e5c47a2827a362f9e1b763336a52f926126aa6dc7123/flake8-7.3.0.tar.gz", hash = "sha256:fe044858146b9fc69b551a4b490d69cf960fcb78ad1edcb84e7fbb1b4a8e3872", size = 48326, upload-time = "2025-06-20T19:31:35.838Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/9f/56/13ab06b4f93ca7cac71078fbe37fcea175d3216f31f85c3168a6bbd0bb9a/flake8-7.3.0-py2.py3-none-any.whl", hash = "sha256:b9696257b9ce8beb888cdbe31cf885c90d31928fe202be0889a7cdafad32f01e", size = 57922, upload-time = "2025-06-20T19:31:34.425Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "flask"
|
||||
version = "3.1.3"
|
||||
|
|
@ -3422,7 +3408,6 @@ dev = [
|
|||
{ name = "diff-cover" },
|
||||
{ name = "fakeredis" },
|
||||
{ name = "fastapi-offline" },
|
||||
{ name = "flake8" },
|
||||
{ name = "langfuse" },
|
||||
{ name = "openapi-core" },
|
||||
{ name = "opentelemetry-api" },
|
||||
|
|
@ -3591,7 +3576,6 @@ dev = [
|
|||
{ name = "diff-cover", specifier = "==9.7.2" },
|
||||
{ name = "fakeredis", specifier = "==2.34.1" },
|
||||
{ name = "fastapi-offline", specifier = "==1.7.6" },
|
||||
{ name = "flake8", specifier = "==7.3.0" },
|
||||
{ name = "langfuse", specifier = "==2.59.7" },
|
||||
{ name = "openapi-core", marker = "python_full_version < '3.14'", specifier = "==0.22.0" },
|
||||
{ name = "opentelemetry-api", specifier = "==1.28.0" },
|
||||
|
|
@ -5776,15 +5760,6 @@ wheels = [
|
|||
{ url = "https://files.pythonhosted.org/packages/47/8d/d529b5d697919ba8c11ad626e835d4039be708a35b0d22de83a269a6682c/pyasn1_modules-0.4.2-py3-none-any.whl", hash = "sha256:29253a9207ce32b64c3ac6600edc75368f98473906e8fd1043bd6b5b1de2c14a", size = 181259, upload-time = "2025-03-28T02:41:19.028Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pycodestyle"
|
||||
version = "2.14.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/11/e0/abfd2a0d2efe47670df87f3e3a0e2edda42f055053c85361f19c0e2c1ca8/pycodestyle-2.14.0.tar.gz", hash = "sha256:c4b5b517d278089ff9d0abdec919cd97262a3367449ea1c8b49b91529167b783", size = 39472, upload-time = "2025-06-20T18:49:48.75Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/d7/27/a58ddaf8c588a3ef080db9d0b7e0b97215cee3a45df74f3a94dbbf5c893a/pycodestyle-2.14.0-py2.py3-none-any.whl", hash = "sha256:dd6bf7cb4ee77f8e016f9c8e74a35ddd9f67e1d5fd4184d86c3b98e07099f42d", size = 31594, upload-time = "2025-06-20T18:49:47.491Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pycparser"
|
||||
version = "3.0"
|
||||
|
|
@ -5914,15 +5889,6 @@ wheels = [
|
|||
{ url = "https://files.pythonhosted.org/packages/77/c1/6e422f34e569cf8e18df68d1939c81c099d2b61e4f7d9621c8a77560799c/pydantic_settings-2.14.2-py3-none-any.whl", hash = "sha256:a20c97b37910b6550d5ea50fbcc2d4187defe58cd57070b73863d069419c9440", size = 61715, upload-time = "2026-06-19T13:44:55.02Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pyflakes"
|
||||
version = "3.4.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/45/dc/fd034dc20b4b264b3d015808458391acbf9df40b1e54750ef175d39180b1/pyflakes-3.4.0.tar.gz", hash = "sha256:b24f96fafb7d2ab0ec5075b7350b3d2d2218eab42003821c06344973d3ea2f58", size = 64669, upload-time = "2025-06-20T18:45:27.834Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/c2/2f/81d580a0fb83baeb066698975cb14a618bdbed7720678566f1b046a95fe8/pyflakes-3.4.0-py2.py3-none-any.whl", hash = "sha256:f742a7dbd0d9cb9ea41e9a24a918996e8170c799fa528688d40dd582c8265f4f", size = 63551, upload-time = "2025-06-20T18:45:26.937Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pygithub"
|
||||
version = "2.8.1"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue