refactor: inline _parse_email_list in auth_checks to drop enterprise dep

The lazy import from litellm_enterprise inside _normalize_alert_emails
coupled the core proxy auth path to an optional package. Core should not
depend on enterprise, even lazily — it hides the dependency from static
analysis and inverts the intended layering.

Duplicate the 7-line parser locally. It's pure and unlikely to drift; the
enterprise copy stays where it is for its own callers.
This commit is contained in:
Ryan Crabbe 2026-04-18 13:51:00 -07:00
parent 8b86a3b041
commit 029d9bcfc7
No known key found for this signature in database

View file

@ -2946,6 +2946,15 @@ async def _virtual_key_soft_budget_check(
)
def _parse_email_list(raw: Any) -> List[str]:
"""Parse emails from a list or comma-separated string."""
if isinstance(raw, list):
return [e.strip() for e in raw if isinstance(e, str) and e.strip()]
elif isinstance(raw, str):
return [e.strip() for e in raw.split(",") if e.strip()]
return []
def _normalize_alert_emails(
cfg: Optional[Dict[str, Any]],
) -> Dict[str, List[str]]:
@ -2956,10 +2965,6 @@ def _normalize_alert_emails(
"""
if not cfg:
return {}
from litellm_enterprise.enterprise_callbacks.send_emails.base_email import (
_parse_email_list,
)
return {k: _parse_email_list(v) for k, v in cfg.items()}