litellm icon indicating copy to clipboard operation
litellm copied to clipboard

[Bug]: CI: Black formatting runs on every PR but changes are discarded.

Open Chesars opened this issue 2 months ago • 0 comments

Summary

The CI workflow currently runs poetry run black . on every PR, which:

  • Reformats 504 files (~59 seconds per run)
  • Produces this output: "504 files reformatted, 771 files left unchanged"
  • But the changes are never committed or verified
  • All formatting changes are discarded when CI completes
  • This repeats on every single PR

Result: Significant CI resource waste with no benefit.

Current Workflow

- name: Run Black formatting
  run: |
    cd litellm
    poetry run black .
    cd ..

- name: Run Ruff linting
  run: |
    cd litellm
    poetry run ruff check .

Proposed Solutions

Option 1: Verify formatting instead of applying it

Change to black --check which:

  • ✅ Verifies code is formatted (~1 second)
  • ✅ Fails CI if not formatted
  • ✅ Developers format locally before pushing

Required steps:

  1. Apply Black to entire codebase once (one-time PR)
  2. Update workflow to use --check
  3. Update contributing docs

Option 2: Remove Black from CI

If the team prefers no formatting enforcement.

Option 3: Use auto-commit bot

Tools like pre-commit.ci can auto-format and commit back, but adds complexity.

Current waste (per 100 PRs):

  • ~98 minutes of CI time formatting the same files repeatedly
  • Unnecessary GitHub Actions costs

After fix:

  • ~1.6 minutes for verification
  • 96+ minutes saved per 100 PRs

Questions for Maintainers

  1. Should we enforce Black formatting via CI checks?
  2. If yes, would you accept a PR to: - Apply Black formatting to the codebase (one-time) - Update CI workflow to use --check?
  3. Or would you prefer to handle formatting separately?

Relevant log output


Are you a ML Ops Team?

No

What LiteLLM version are you on ?

1.79.1

Twitter / LinkedIn details

No response

Chesars avatar Nov 05 '25 20:11 Chesars