fix(cli): drop enum.StrEnum so the CLI imports on Python 3.10

Backport of #41046 to rc/1.102.0.
Cherry-picked from merge commit 1ba97665b2 (main), originally by app/devin-ai-integration.
This commit is contained in:
mateo-berri 2026-09-18 11:10:27 -07:00
parent 31d78fa084
commit 034998be71
3 changed files with 13 additions and 3 deletions

View file

@ -178,7 +178,7 @@ jobs:
version: "0.10.9"
- name: Install dependencies
run: uv sync --frozen --extra proxy --python 3.10
run: uv sync --frozen --extra proxy --extra cli --python 3.10
- run: uv run --no-sync python --version
@ -187,3 +187,6 @@ jobs:
- name: Check litellm CLI
run: uv run --no-sync litellm --version
- name: Check lite CLI
run: uv run --no-sync lite version

View file

@ -10,7 +10,7 @@ import os
import tempfile
from collections.abc import Callable, Mapping
from dataclasses import dataclass
from enum import StrEnum
from enum import Enum
from pathlib import Path
from types import MappingProxyType
from 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 callers

View file

@ -20,6 +20,13 @@ from litellm.proxy.client.cli.commands.pi import (
)
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