Merge pull request #41046 from BerriAI/devin/1789368982-cli-strenum-py310

fix(cli): drop enum.StrEnum so the CLI imports on Python 3.10
This commit is contained in:
Mateo Wang 2026-09-14 18:32:30 -07:00 committed by GitHub
commit 1ba97665b2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
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