From 9dc591fc20a0d182d000a79105d55f1d86f8ff2d Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Tue, 3 Nov 2026 18:44:39 +0000 Subject: [PATCH] refactor(proxy): remove dead DynamoDB implementation --- litellm/proxy/db/base_client.py | 44 ------------ litellm/proxy/db/dynamo_db.py | 72 ------------------- pyproject.toml | 1 - .../test_e2e_pod_lock_manager.py | 1 - .../test_key_generate_prisma.py | 1 - uv.lock | 14 ---- 6 files changed, 133 deletions(-) delete mode 100644 litellm/proxy/db/base_client.py delete mode 100644 litellm/proxy/db/dynamo_db.py diff --git a/litellm/proxy/db/base_client.py b/litellm/proxy/db/base_client.py deleted file mode 100644 index 237942016c1..00000000000 --- a/litellm/proxy/db/base_client.py +++ /dev/null @@ -1,44 +0,0 @@ -from typing import Literal - - -class CustomDB: - """ - Implements a base class that we expect any custom db implementation (e.g. DynamoDB) to follow - """ - - def __init__(self) -> None: - pass - - def get_data(self, key: str, table_name: Literal["user", "key", "config"]): - """ - Check if key valid - """ - - def insert_data(self, value: object, table_name: Literal["user", "key", "config"]): - """ - For new key / user logic - """ - - def update_data(self, key: str, value: object, table_name: Literal["user", "key", "config"]): - """ - For cost tracking logic - """ - - def delete_data(self, keys: list[str], table_name: Literal["user", "key", "config"]): - """ - For /key/delete endpoint s - """ - - def connect( - self, - ): - """ - For connecting to db and creating / updating any tables - """ - - def disconnect( - self, - ): - """ - For closing connection on server shutdown - """ diff --git a/litellm/proxy/db/dynamo_db.py b/litellm/proxy/db/dynamo_db.py deleted file mode 100644 index f475f412c4e..00000000000 --- a/litellm/proxy/db/dynamo_db.py +++ /dev/null @@ -1,72 +0,0 @@ -""" -Deprecated. Only PostgresSQL is supported. -""" - -from typing import Final - -from litellm._logging import verbose_proxy_logger -from litellm.proxy._types import DynamoDBArgs -from litellm.proxy.db.base_client import CustomDB - - -class DynamoDBWrapper(CustomDB): - from aiodynamo.credentials import Credentials, StaticCredentials - - credentials: Credentials - - def __init__(self, database_arguments: DynamoDBArgs): - from aiodynamo.models import PayPerRequest, Throughput - - self.throughput_type = None - if database_arguments.billing_mode == "PAY_PER_REQUEST": - self.throughput_type = PayPerRequest() - elif database_arguments.billing_mode == "PROVISIONED_THROUGHPUT": - if ( - database_arguments.read_capacity_units is not None - and isinstance(database_arguments.read_capacity_units, int) - and database_arguments.write_capacity_units is not None - and isinstance(database_arguments.write_capacity_units, int) - ): - self.throughput_type = Throughput( - read=database_arguments.read_capacity_units, - write=database_arguments.write_capacity_units, - ) - else: - raise Exception( - f"Invalid args passed in. Need to set both read_capacity_units and write_capacity_units. Args passed in - {database_arguments}" - ) - self.database_arguments = database_arguments - self.region_name = database_arguments.region_name - - def set_env_vars_based_on_arn(self): - if self.database_arguments.aws_role_name is None: - return - verbose_proxy_logger.debug("DynamoDB: setting env vars based on arn=%s", self.database_arguments.aws_role_name) - import os - - import boto3 - - sts_client: Final = boto3.client("sts") - - # call 1 - sts_client.assume_role_with_web_identity( - RoleArn=self.database_arguments.aws_role_name, - RoleSessionName=self.database_arguments.aws_session_name, - WebIdentityToken=self.database_arguments.aws_web_identity_token, - ) - - # call 2 - assumed_role: Final = sts_client.assume_role( - RoleArn=self.database_arguments.assume_role_aws_role_name, - RoleSessionName=self.database_arguments.assume_role_aws_session_name, - ) - - aws_access_key_id: Final = assumed_role["Credentials"]["AccessKeyId"] - aws_secret_access_key: Final = assumed_role["Credentials"]["SecretAccessKey"] - aws_session_token: Final = assumed_role["Credentials"]["SessionToken"] - - verbose_proxy_logger.debug("Got STS assumed Role, aws_access_key_id=%s", aws_access_key_id) - # set these in the env so aiodynamo can use them - os.environ["AWS_ACCESS_KEY_ID"] = aws_access_key_id - os.environ["AWS_SECRET_ACCESS_KEY"] = aws_secret_access_key - os.environ["AWS_SESSION_TOKEN"] = aws_session_token diff --git a/pyproject.toml b/pyproject.toml index 7a653b28f81..46cfbdad71d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -288,7 +288,6 @@ ci = [ "traceloop-sdk==0.34.0", "detect-secrets==1.5.0", "PyGithub==2.8.1", - "aiodynamo==24.7", "argon2-cffi==25.1.0", "assemblyai==0.52.4", "jsonlines==4.0.0", diff --git a/tests/unit/proxy/db/db_transaction_queue/test_e2e_pod_lock_manager.py b/tests/unit/proxy/db/db_transaction_queue/test_e2e_pod_lock_manager.py index d2c6b661068..8c0556ffb5b 100644 --- a/tests/unit/proxy/db/db_transaction_queue/test_e2e_pod_lock_manager.py +++ b/tests/unit/proxy/db/db_transaction_queue/test_e2e_pod_lock_manager.py @@ -72,7 +72,6 @@ from litellm.types.proxy.management_endpoints.ui_sso import ( LiteLLM_UpperboundKeyGenerateParams, ) from litellm.proxy._types import ( - DynamoDBArgs, GenerateKeyRequest, KeyRequest, NewCustomerRequest, diff --git a/tests/unit/proxy/management_endpoints/test_key_generate_prisma.py b/tests/unit/proxy/management_endpoints/test_key_generate_prisma.py index 26f1603ccca..8fd0768b447 100644 --- a/tests/unit/proxy/management_endpoints/test_key_generate_prisma.py +++ b/tests/unit/proxy/management_endpoints/test_key_generate_prisma.py @@ -95,7 +95,6 @@ from litellm.types.proxy.management_endpoints.ui_sso import ( LiteLLM_UpperboundKeyGenerateParams, ) from litellm.proxy._types import ( - DynamoDBArgs, GenerateKeyRequest, KeyRequest, NewCustomerRequest, diff --git a/uv.lock b/uv.lock index e5948530f17..8bc0be01e91 100644 --- a/uv.lock +++ b/uv.lock @@ -62,18 +62,6 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/d4/ea/3a5b160cfd51c67759b08748051094d9365ceff18127633d0021950c9860/a2a_sdk-1.1.0-py3-none-any.whl", hash = "sha256:d7f5846caf18033d8bf3108b11ec827dd8dd32f867c98848ede0e39474be93be", size = 241886, upload-time = "2026-05-29T09:34:41.484Z" }, ] -[[package]] -name = "aiodynamo" -version = "24.7" -source = { registry = "https://pypi.org/simple" } -dependencies = [ - { name = "yarl" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/2a/31/c455ae437c1ed5a9e354e5aca2b616599fd0f9c36064529cecb40663a368/aiodynamo-24.7.tar.gz", hash = "sha256:6b34c1505a4aca372d60d140b9cbe7934650d1daa360e55a1e090d86af871dbb", size = 25431, upload-time = "2024-07-13T08:38:40.674Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/35/66/a08e633c33083fb6fe84745f5b3ab9833d356afa702e08a4136c0d615e0d/aiodynamo-24.7-py3-none-any.whl", hash = "sha256:4749855dad14e0fe96b09e2d3604582f4bad156b18da90f9612260fd06523913", size = 28718, upload-time = "2024-07-13T08:38:39.141Z" }, -] - [[package]] name = "aiofiles" version = "24.1.0" @@ -5115,7 +5103,6 @@ benchmarks = [ { name = "pytest-codspeed" }, ] ci = [ - { name = "aiodynamo" }, { name = "anthropic" }, { name = "argon2-cffi" }, { name = "assemblyai" }, @@ -5344,7 +5331,6 @@ benchmarks = [ { name = "pytest-codspeed", specifier = "==4.3.0" }, ] ci = [ - { name = "aiodynamo", specifier = "==24.7" }, { name = "anthropic", specifier = "==0.84.0" }, { name = "argon2-cffi", specifier = "==25.1.0" }, { name = "assemblyai", specifier = "==0.52.4" },