From 029d9bcfc786bb35b3a7a31d1d87859febb01aeb Mon Sep 17 00:00:00 2001 From: Ryan Crabbe Date: Sat, 18 Apr 2026 13:51:00 -0700 Subject: [PATCH] refactor: inline _parse_email_list in auth_checks to drop enterprise dep MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- litellm/proxy/auth/auth_checks.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/litellm/proxy/auth/auth_checks.py b/litellm/proxy/auth/auth_checks.py index 06f015f4b29..ba4b4f37539 100644 --- a/litellm/proxy/auth/auth_checks.py +++ b/litellm/proxy/auth/auth_checks.py @@ -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()}