The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
fix(cli): drop enum.StrEnum so the CLI imports on Python 3.10
Devin AI03e6dd051cdc
diff --git a/litellm/proxy/client/cli/commands/pi.py b/litellm/proxy/client/cli/commands/pi.pyindex 9810e81ae36..5c749959638 100644--- a/litellm/proxy/client/cli/commands/pi.py+++ b/litellm/proxy/client/cli/commands/pi.py@@ -10,7 +10,7 @@ import osimport tempfilefrom collections.abc import Callable, Mappingfrom dataclasses import dataclass-from enum import StrEnum+from enum import Enumfrom pathlib import Pathfrom types import MappingProxyTypefrom typing import Annotated, Final@@ -25,7 +25,7 @@ LITELLM_PROXY_API_KEY_ENV: Final = "LITELLM_PROXY_API_KEY"_REJECTED_STATUSES: Final = frozenset((401, 403))-class ListingFailure(StrEnum):+class ListingFailure(str, Enum):"""Why a proxy could not be listed, decided once where the HTTP outcome is classified.`unreachable` means no response at all; the other kinds prove the proxy answered, so callersdiff --git a/tests/test_litellm/proxy/client/cli/test_pi.py b/tests/test_litellm/proxy/client/cli/test_pi.pyindex 03e5d7dd197..3c343c9e268 100644--- a/tests/test_litellm/proxy/client/cli/test_pi.py+++ b/tests/test_litellm/proxy/client/cli/test_pi.py@@ -1,3 +1,4 @@+import inspectimport jsonimport osimport stat@@ -7,6 +8,7 @@ from pathlib import Pathimport pytestimport requests+from litellm.proxy.client.cli.commands import pifrom litellm.proxy.client.cli.commands.pi import (ListingFailure,ModelLimits,@@ -20,6 +22,18 @@ from litellm.proxy.client.cli.commands.pi import ()+def test_pi_module_has_no_strenum_import():+ """enum.StrEnum is Python 3.11+; pyproject allows 3.10, so pi.py must not import it."""+ assert "StrEnum" not in inspect.getsource(pi)+++def test_listing_failure_is_str_enum():+ assert issubclass(ListingFailure, str)+ assert ListingFailure.REJECTED.value == "rejected"+ assert ListingFailure("rejected") is ListingFailure.REJECTED+ assert str(ListingFailure.REJECTED.value) == "rejected"++class _FakeResponse:def __init__(self, status_code, payload=None):self.status_code = status_code