mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-07 11:28:35 -05:00
[GH-ISSUE #21641] feat: Add Ruff linter & formatter for Python code quality #35071
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @ashm-dev on GitHub (Feb 20, 2026).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/21641
Problem Description
The backend currently relies on
blackfor formatting but has no linter configured. This means common code issues — unused imports, bare excepts, mutable default arguments, f-strings without placeholders, shadowed variables — go undetected and slip into the codebase silently.Desired Solution
Add Ruff as both linter and formatter:
[tool.ruff]configuration topyproject.tomlwith a practical rule set (E,F,W,I,UP, etc.)blackwith Ruff's built-in formatter (fullblackcompatibility, 10-100x faster)I already have a working local branch with these changes and I'm ready to fully take this on and submit a PR.
Alternatives Considered
black+ addflake8/pylint— works but means maintaining multiple tools with separate configs. Ruff covers both in a single, faster package.Additional Context
Ruff is already adopted by FastAPI, Pydantic, Hugging Face Transformers, and other major Python projects. It's a single Rust-based tool that replaces
black,isort,flake8,pyupgrade, and dozens of other plugins with near-instant execution.