Auto-format your code and catch common mistakes with Ruff — one fast tool that replaces black, isort, and flake8.
Why: a formatter rewrites your code into one consistent style automatically — spacing, quotes, line length — so you never argue about it or fix it by hand. Everyone’s code ends up looking the same, which makes it easier to read and review.
# before — messy spacing and quotes
x={'a':1,'b':2}
def add(a,b ):
return a+b
# after the formatter runs:
x = {'a': 1, 'b': 2}
def add(a, b):
return a + bWhy: Ruff is an extremely fast tool that both formats your code and lints it (flags likely mistakes). It does the job of several older tools (black, isort, flake8) at once.
Install it, then format every file in the folder:
pip install ruffruff format .Why: linting scans for likely bugs and bad patterns — an unused import, a variable that is never used. "ruff check" reports them and "--fix" repairs the safe ones automatically.
ruff check .ruff check --fix .Note: Ruff reads its settings from the same pyproject.toml that holds your dependencies, so all your project config lives in one place.
# pyproject.toml
[tool.ruff]
line-length = 88
[tool.ruff.lint]
# a curated, sensible default set of rules
select = ["E", "F", "I"]