litellm/ruff.toml
mateo-berri 4e32a8bf6a chore(lint): remove litellm/types from the ruff lint exclusion
ruff.toml has excluded litellm/types/* since 2024, so no lint rule ever ran
on the types tree. Remove the exclusion, apply ruff --fix and ruff format
across litellm/types, and hand-fix what autofix cannot reach so the
pyupgrade budgets stay at zero: implicit type aliases converted to PEP 604
unions, RootModel[Union[...]] bases, duplicate imports, and a stray print.

Load-bearing import X as X re-exports deleted by preview-mode F401 are
restored, and the six star-imported hub modules keep their re-export
surface via per-file F401 ignores. Star-import consumers that silently
relied on typing names leaking from those hubs are modernized to builtin
generics and PEP 604 unions.

Runtime annotation introspection that only recognized typing.Union is
taught types.UnionType (guardrail UI field schemas, volcengine response
fill), with regression tests for both. Strict budget limits for the rules
the types tree now trips are raised to exact measured totals, so any
net-new violation still fails the gate
2026-08-05 01:10:15 -07:00

37 lines
1.7 KiB
TOML

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", "TID251",
# 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/__init__.py", "litellm/proxy/example_config_yaml/*", "tests/*"]
[lint.per-file-ignores]
"litellm/main.py" = ["F401"]
"litellm/types/caching.py" = ["F401"]
"litellm/types/integrations/slack_alerting.py" = ["F401"]
"litellm/types/llms/custom_http.py" = ["F401"]
"litellm/types/llms/openai.py" = ["F401"]
"litellm/types/proxy/management_endpoints/scim_v2.py" = ["F401"]
"litellm/types/responses/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"]