← Courses

Python for AI — Beginner Foundations

Data Science

Tools · Lesson 65 of 76

Formatting with Ruff

Ruff is a fast tool that checks your code for style problems and can fix many of them automatically — so you don't have to fuss over spacing and small mistakes by hand.

With uv, add and run it like this:

uv add --dev ruff
uv run ruff check .      # report problems
uv run ruff format .     # auto-tidy the formatting

ruff check points out issues (unused imports, undefined names, messy style); ruff format rewrites your files to a clean, consistent layout. Running it before you share code keeps everything neat without effort — the machine handles the tidying so you focus on the logic.

You’re reading for free. Sign in to keep your progress and earn a certificate when you finish.Sign in to keep my progress →