How to Install Ruff on Debian: The Extremely Fast Python Linter and Formatter

Ruff is an extremely fast Python linter and code formatter written in Rust by Astral, the same team behind uv. A single binary replaces a whole stack of Python tooling, Flake8, isort, pyupgrade, pydocstyle, autoflake and even Black-style formatting, while running orders of magnitude faster than the tools it consolidates.

Ruff is not available in the official Debian archive, so installing it usually means reaching for pip, the standalone installer, or a manual binary download, along with the ongoing chore of updating it yourself.

The unofficial deb.griffo.io repository packages Ruff as a standard Debian .deb served over APT, so you install it and keep it current with the same tooling you use for everything else, no Python environment required.

What Makes Ruff Special?

  • ⚡ Extreme speed - Lints large codebases in a fraction of a second thanks to its Rust core.
  • 🧹 Linter and formatter in one - ruff check lints and ruff format formats, from a single binary.
  • 🔁 Broad rule coverage - Reimplements hundreds of rules from Flake8, isort, pyupgrade, pydocstyle and more.
  • 🛠️ Automatic fixes - --fix safely rewrites many violations for you.
  • 🎯 Drop-in Black compatibility - The formatter is designed to match Black’s style closely.
  • 📦 Single static binary - No Python interpreter or virtual environment needed to run it.
  • ⚙️ pyproject.toml native - Configure everything from your existing project file.
  • 🔌 Editor integration - First-class LSP support powers fast in-editor diagnostics.

Why Use the deb.griffo.io Repository?

  • Easy installation and updates through APT.
  • Automatic dependency management handled by Debian packaging.
  • Always tracks upstream releases so you stay near the latest Ruff.
  • No compiling from source and no Rust toolchain or pip environment to manage.
  • Works across supported Debian releases, with the codename detected automatically.

Prerequisites

Before you begin, make sure you have:

  • A Debian-based system (Bookworm 12, Trixie 13, or Sid)
  • sudo privileges
  • curl installed (sudo apt install curl if needed)

Step 1: Add the deb.griffo.io Repository

Add the signing key and repository source:

# Create the keyrings directory
sudo install -d -m 0755 /etc/apt/keyrings

# Download and install the repository GPG key
curl -fsSL https://deb.griffo.io/EA0F721D231FDD3A0A17B9AC7808B4DD62C41256.asc | sudo gpg --dearmor --yes -o /etc/apt/keyrings/deb.griffo.io.gpg

# Add the repository (auto-detects your distro codename)
echo "deb [signed-by=/etc/apt/keyrings/deb.griffo.io.gpg] https://deb.griffo.io/apt $(lsb_release -sc 2>/dev/null) main" | sudo tee /etc/apt/sources.list.d/deb.griffo.io.list > /dev/null

# Update the package list
sudo apt update

What each command does:

  1. Create the keyrings directory - ensures /etc/apt/keyrings exists with correct permissions.
  2. Install the GPG key - downloads the key and de-armours it into a dedicated keyring for verification.
  3. Add the repository - writes a signed-by source line, using lsb_release -sc to detect your Debian codename.
  4. Update the package list - refreshes APT so it knows about the new packages.

Step 2: Update the Package List

If you skipped the last line, refresh the index now:

sudo apt update

Step 3: Install Ruff

Install Ruff with APT:

sudo apt install ruff

APT downloads the single Ruff binary and installs it system-wide.

Step 4: Verify the Installation

The binary is ruff. Check the version:

ruff --version

You should see output similar to:

ruff 0.6.9

Getting Started with Ruff

Linting Your Code

The linter is invoked with ruff check:

# Lint the whole project
ruff check .

# Lint a single file or directory
ruff check src/

# Automatically fix what can be fixed safely
ruff check --fix .

# Include fixes marked as potentially unsafe
ruff check --fix --unsafe-fixes .

Ruff prints each violation with its rule code (for example F401 for an unused import) so you can look it up or selectively ignore it.

Formatting Your Code

The formatter is ruff format, which aims to match Black’s output:

# Format the entire project in place
ruff format .

# Check formatting without writing changes (useful in CI)
ruff format --check .

# Show a diff of what would change
ruff format --diff .

Configuring Ruff in pyproject.toml

Ruff reads its configuration from pyproject.toml (or a dedicated ruff.toml). A typical block:

[tool.ruff]
line-length = 88
target-version = "py312"

[tool.ruff.lint]
select = ["E", "F", "I", "UP", "B"]
ignore = ["E501"]

[tool.ruff.format]
quote-style = "double"
indent-style = "space"

Here select enables rule groups (pycodestyle errors, Pyflakes, isort, pyupgrade and flake8-bugbear), while the format table controls the formatter.

A Typical Pre-Commit Workflow

A common local loop before committing is to fix, format, then verify:

# Fix lint issues, then format
ruff check --fix .
ruff format .

# Confirm everything is clean (exit non-zero on problems)
ruff check .
ruff format --check .

The final two commands are exactly what you would run in a CI pipeline to enforce the same standards.

Explaining and Listing Rules

Ruff can document its own rules:

# Explain a specific rule
ruff rule F401

# List every rule Ruff knows about
ruff linter

Keeping Ruff Updated

Because Ruff came from APT, updates arrive with your regular system upgrades:

sudo apt update && sudo apt upgrade

When deb.griffo.io publishes a newer Ruff, apt upgrade installs it automatically.

Other Tools from deb.griffo.io

The repository packages several tools that fit a Python workflow:

  • uv - the fast Python package and project manager from the same team.
  • just - a command runner to wire up lint and format tasks.
  • Neovim - an editor with excellent Ruff LSP integration.
  • Zed - a high-performance editor that speaks Ruff’s language server.

Troubleshooting

GPG or Key Errors

If APT reports an unsigned repository or an invalid key, re-import it:

curl -fsSL https://deb.griffo.io/EA0F721D231FDD3A0A17B9AC7808B4DD62C41256.asc | sudo gpg --dearmor --yes -o /etc/apt/keyrings/deb.griffo.io.gpg
sudo apt update

Package Not Found

If APT cannot find ruff:

  1. Re-run sudo apt update after adding the repository.
  2. Confirm your release is supported (Bookworm, Trixie, or Sid).
  3. Check the source list: cat /etc/apt/sources.list.d/deb.griffo.io.list.

Two Copies of Ruff on Your PATH

If you previously installed Ruff via pip, a second binary in a virtual environment or ~/.local/bin may shadow the packaged one, leading to version confusion:

which -a ruff

Remove the pip-installed copy (pip uninstall ruff) or reorder your PATH so /usr/bin/ruff takes precedence, then confirm with ruff --version.

Uninstalling

Remove Ruff with:

sudo apt remove ruff

To also drop the repository and key:

sudo rm /etc/apt/sources.list.d/deb.griffo.io.list
sudo rm /etc/apt/keyrings/deb.griffo.io.gpg
sudo apt update

Conclusion

Installing Ruff from deb.griffo.io gives Debian users a fast, all-in-one linter and formatter without pip environments or a Rust toolchain. ruff check and ruff format cover both linting and formatting from one static binary, and keeping it current is simply another apt upgrade.

Whether you are tightening up a single project or standardising a whole team’s Python style, Ruff’s speed makes it comfortable to run on every save and every commit, and APT makes it effortless to keep updated.

Resources


Disclaimer: The deb.griffo.io repository is an unofficial community project and is not affiliated with the official Debian or Ubuntu projects, or with the upstream Ruff project.