Ruff: Python linter and formatter
Ruff is a fast Python linter and code formatter written in Rust. It catches bugs such as undefined names and unused imports before you run your code.
astral-sh/ruff
- Stars
- 50.1k
- Forks
- 2.5k
- Language
- Rust
- Licence
- MIT
- Last push
- 15 Oct 2026
On GitHub: An extremely fast Python linter and code formatter, written in Rust.
Open on GitHubRuff reads your source files without running them and reports problems: names that are never defined, imports that are never used, variables that shadow built-ins, risky patterns and style issues. It reimplements rules from many established tools, including Flake8 and its popular plugins, isort and pyupgrade, and ruff format provides a formatter designed to match Black’s output. Many issues can be fixed automatically with ruff check --fix.
Use it on every project: run ruff check . and ruff format . locally, in a pre-commit hook and in CI. Rules are enabled and configured in pyproject.toml under [tool.ruff]. Editor integrations show problems as you type, which turns many runtime errors into red underlines.
A linter complements tests rather than replacing them: Ruff finds mistakes visible in the code itself, while pytest checks behavior. Together with a type checker they catch a large share of the errors described in the Common errors section, such as calling methods on values that may be None.
See also
- 0006 Testing with pytest: first tests, fixtures and parametrize pytest runs plain functions whose names start with test_ and reports every failing assert in detail. This guide covers setup, assertions, exceptions,… Intermediate · How-to · Any system Article Testing 15 Oct 2026
- 0007 Fix: ModuleNotFoundError: No module named ‘…’ Python cannot find a module you import. Usually the package was installed into a different interpreter or virtual environment than the one… Beginner · Fix · Any system Article Common errors · Environments & packages 15 Oct 2026
- 0008 Fix: TypeError: ‘NoneType’ object is not subscriptable You used [ ] on a value that is None. Something you expected to return a list, dict or match returned nothing.… Beginner · Fix · Any system Article Common errors 15 Oct 2026
- 0073 Fix: json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0) Python's json module found nothing it could parse at the very first character. The input is usually empty, HTML, or already consumed.… Beginner · Fix · Any system Article Common errors · CSV & JSON 15 Oct 2026
- 0261 Build a Python command-line to-do app: from empty folder to installable command Create a small to-do tool in Python with argparse and JSON storage, test it with pytest and package it with pyproject.toml so… Beginner · Tutorial · Any system Article Environments & packages · Files & automation · Testing 15 Oct 2026
History
Every saved edit is kept. The plot on the sleeve draws one line per edit. Open any edit to see exactly what changed.
- commitpedia-admin +1,013 chars