Skip to content

chore(proxy): remove duplicate Sequence import in team endpoints - #35479

Merged
yuneng-berri merged 1 commit into
litellm_internal_stagingfrom
litellm_/duplicate-sequence-import-544892
Aug 1, 2026
Merged

chore(proxy): remove duplicate Sequence import in team endpoints#35479
yuneng-berri merged 1 commit into
litellm_internal_stagingfrom
litellm_/duplicate-sequence-import-544892

Conversation

@yuneng-berri

Copy link
Copy Markdown
Collaborator

TLDR

Problem this solves:

  • team_endpoints.py trips ruff F811 on staging
  • Sequence is imported from both collections.abc and typing
  • the typing copy shadows the one every annotation reads

How it solves it:

  • drop Sequence from the typing import block
  • keep from collections.abc import Sequence

Relevant issues

Linear ticket

Pre-Submission checklist

Please complete all items before asking a LiteLLM maintainer to review your PR

  • I have added meaningful tests
  • My PR passes all CI/CD checks (e.g., lint, format, unit tests)
  • My PR's scope is as isolated as possible; it only solves 1 specific problem
  • I have received a Greptile Confidence Score of at least 4/5 before requesting a maintainer review (Greptile reviews automatically once the PR is opened; only comment @greptileai to re-request a review after pushing changes)

No test is added here on purpose. F811 is enforced repo-wide by make lint, so reintroducing the duplicate import turns CI red on its own; a unit test asserting the shape of an import block would assert nothing the linter does not already catch

Delays in PR merge?

If you're seeing a delay in your PR being merged, ping the LiteLLM Team on Slack (#pr-review).

Screenshots / Proof of Fix

This change removes a shadowed import name; it has no request path and no runtime behavior to exercise, so the proof is the linter that currently fails

Before, at 1e7b39d15c (current litellm_internal_staging head):

git show 1e7b39d15c:litellm/proxy/management_endpoints/team_endpoints.py | uv run ruff check --stdin-filename litellm/proxy/management_endpoints/team_endpoints.py -
F811 Redefinition of unused `Sequence` from line 16
  --> litellm/proxy/management_endpoints/team_endpoints.py:25:5
   |
23 |     Optional,
24 |     Protocol,
25 |     Sequence,
   |     ^^^^^^^^ `Sequence` redefined here
26 |     Tuple,
27 |     TypeVar,
   |
  ::: litellm/proxy/management_endpoints/team_endpoints.py:16:29
   |
14 | import math
15 | import traceback
16 | from collections.abc import Sequence
   |                             -------- previous definition of `Sequence` here
17 | from datetime import datetime, timezone
18 | from typing import (
   |
help: Remove definition: `Sequence`

Found 1 error.

After, at c541fb2b7a (this PR):

uv run ruff check litellm/proxy/management_endpoints/team_endpoints.py
All checks passed!

Full make pre-commit on the branch also passes: ruff, the strict / type-discipline / basedpyright budget gates, the circular-import check, format, and the dashboard API type sync

Type

🐛 Bug Fix

Changes

from collections.abc import Sequence landed in e8e2e07ef6 (#35435) while Sequence was already in the file's typing import block, and the two only met when that PR merged into staging, so the duplicate reached staging without either side seeing it. All 11 uses in the file are subscripted generics (Sequence[Member] and friends), which behave identically under both spellings, so keeping the collections.abc one and deleting the typing one is a no-op at runtime

Final Attestation

  • The tests check the right things, including the edge cases, and regressions in the respective real-world customer use-cases are not possible after this PR

@greptile-apps

greptile-apps Bot commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Removes the duplicate typing.Sequence import while retaining collections.abc.Sequence, resolving the Ruff F811 violation without changing runtime behavior

  • Keeps the existing Sequence annotations backed by collections.abc
  • Removes the shadowing import from the typing import block

Confidence Score: 5/5

The PR appears safe to merge because it only removes a duplicate import while preserving the symbol used by existing annotations

Sequence remains imported from collections.abc, so all existing references continue to resolve while the Ruff F811 violation is eliminated

Important Files Changed

Filename Overview
litellm/proxy/management_endpoints/team_endpoints.py Safely removes a redundant Sequence import; no behavioral, typing, or security regression was identified

Reviews (1): Last reviewed commit: "chore(proxy): remove duplicate Sequence ..." | Re-trigger Greptile

@yuneng-berri
yuneng-berri enabled auto-merge August 1, 2026 19:20
@codecov

codecov Bot commented Aug 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@yuneng-berri
yuneng-berri merged commit 0a42f28 into litellm_internal_staging Aug 1, 2026
80 checks passed
@yuneng-berri
yuneng-berri deleted the litellm_/duplicate-sequence-import-544892 branch August 1, 2026 19:29
@codspeed-hq

codspeed-hq Bot commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 31 untouched benchmarks


Comparing litellm_/duplicate-sequence-import-544892 (c541fb2) with litellm_internal_staging (2b30708)1

Open in CodSpeed

Footnotes

  1. No successful run was found on litellm_internal_staging (c541fb2) during the generation of this report, so 2b30708 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants