docs(db_authenticator): explain the inline imports in persist_credential_to_db

Greptile flagged the inline proxy imports as an acknowledged P2 style
nit. Documenting the two real reasons they're inline so the next reader
doesn't 'fix' them into a module-level import and break things.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Jason Cook 2026-04-16 20:58:40 -04:00
parent 796e51713b
commit d663094202
2 changed files with 8 additions and 0 deletions

View file

@ -147,6 +147,10 @@ async def persist_credential_to_db(item: CredentialItem) -> None:
login endpoint (which can ``await`` it directly on the request event
loop).
"""
# Inline imports: proxy_server transitively imports this module via
# the OAuth router (avoids circular), and prisma_client is a
# module-level global mutated at proxy startup — a top-level import
# would bind the stale None reference rather than the live client.
from litellm.proxy.common_utils.encrypt_decrypt_utils import encrypt_value_helper
from litellm.proxy.proxy_server import prisma_client

View file

@ -159,6 +159,10 @@ def _persist_item_sync(item: CredentialItem) -> None:
async def persist_credential_to_db(item: CredentialItem) -> None:
# Inline imports: proxy_server transitively imports this module via
# the OAuth router (avoids circular), and prisma_client is a
# module-level global mutated at proxy startup — a top-level import
# would bind the stale None reference rather than the live client.
from litellm.proxy.common_utils.encrypt_decrypt_utils import encrypt_value_helper
from litellm.proxy.proxy_server import prisma_client