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

Ruff is an extremely fast Python linter and formatter written in Rust by Astral. One binary does the job of Flake8, isort, pyupgrade, pydocstyle, autoflake and a Black-compatible formatter, and it does so hundreds of times faster than the individual tools it replaces, which is exactly why so many Python projects have consolidated their tooling around it.

Ruff is not in the Ubuntu archive, so the usual installation routes are pip, the standalone shell installer, or a manually fetched binary, each of which leaves you to handle updates by hand.

The unofficial deb.griffo.io repository takes a simpler approach: Ruff packaged as a native Ubuntu .deb and delivered over APT. You install it and update it with the same commands as the rest of your system, with no Python environment involved.

What Makes Ruff Special?

  • ⚡ Extreme speed - Its Rust engine lints huge projects in well under a second.
  • 🧹 Linter and formatter in one - ruff check for linting, ruff format for formatting, one binary.
  • 🔁 Broad rule coverage - Ports hundreds of rules from Flake8, isort, pyupgrade, pydocstyle and beyond.
  • 🛠️ Automatic fixes - --fix rewrites many violations for you in place.
  • 🎯 Black-compatible formatting - The formatter closely mirrors Black’s output.
  • 📦 Single static binary - Runs without a Python interpreter or virtualenv.
  • ⚙️ pyproject.toml native - All configuration lives in your existing project file.
  • 🔌 Editor integration - A built-in language server gives instant in-editor diagnostics.

Why Use the deb.griffo.io Repository?

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

Prerequisites

Make sure you have:

  • An Ubuntu system (Jammy 22.04 LTS, Noble 24.04 LTS, or newer)
  • sudo privileges
  • curl installed (sudo apt install curl if needed)

Step 1: Add the deb.griffo.io Repository

Register the 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

Breaking it down:

  1. Create the keyrings directory - makes sure /etc/apt/keyrings exists with the right permissions.
  2. Install the GPG key - downloads and de-armours the key into its own keyring so APT can verify signatures.
  3. Add the repository - writes a signed-by source line, with lsb_release -sc supplying your Ubuntu codename.
  4. Update the package list - refreshes APT’s view of available packages.

Step 2: Update the Package List

If you did not run the last command above, do it now:

sudo apt update

Step 3: Install Ruff

Install with APT:

sudo apt install ruff

APT installs the single Ruff binary across the system.

Step 4: Verify the Installation

The binary is ruff. Confirm the version:

ruff --version

You should see something like:

ruff 0.6.9

Getting Started with Ruff

Configuring Ruff First

On a new project it pays to set your rules and formatting up front in pyproject.toml, so both linting and formatting behave consistently:

[tool.ruff]
line-length = 100
target-version = "py311"

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

[tool.ruff.lint.per-file-ignores]
"__init__.py" = ["F401"]

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

select turns on rule groups such as pycodestyle, Pyflakes, isort, flake8-bugbear, flake8-simplify and pyupgrade, while per-file-ignores relaxes rules for specific files.

Linting

Run the linter with ruff check:

# Lint the whole project
ruff check .

# Apply safe automatic fixes
ruff check --fix .

# Watch mode: re-lint as files change
ruff check --watch .

Each finding is tagged with a rule code like SIM108 so you can investigate or suppress it precisely.

Formatting

Format code with ruff format, whose style tracks Black closely:

# Format everything in place
ruff format .

# CI-friendly check that makes no changes
ruff format --check .

# Preview changes as a diff
ruff format --diff .

Combining Lint and Format in CI

A reliable continuous-integration check runs both tools in non-mutating mode so the build fails on any deviation:

# Fails if formatting would change anything
ruff format --check .

# Fails if any lint rule is violated
ruff check --output-format=github .

The --output-format=github option emits annotations that many CI systems render inline on the pull request.

Inspecting Rules

Ruff can describe its rules directly from the command line:

# Explain a single rule in detail
ruff rule B008

# List all available linters and their prefixes
ruff linter

Keeping Ruff Updated

Ruff rides your normal Ubuntu update cycle:

sudo apt update && sudo apt upgrade

When deb.griffo.io ships a newer Ruff, apt upgrade installs it alongside your other packages.

Other Tools from deb.griffo.io

The repository carries several tools that pair well with Ruff:

  • uv - the fast Python package and project manager from Astral.
  • just - a task runner for defining lint and format recipes.
  • Neovim - an editor with strong Ruff LSP support.
  • Zed - a high-performance editor that integrates the Ruff language server.

Troubleshooting

GPG or Key Errors

If APT flags the repository as unsigned or the key as invalid, re-add 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 locate ruff:

  1. Re-run sudo apt update after adding the repository.
  2. Verify your Ubuntu release is supported (Jammy, Noble, or newer).
  3. Inspect the source list: cat /etc/apt/sources.list.d/deb.griffo.io.list.

A pip-Installed Ruff Wins on PATH

If you have Ruff installed inside an active virtual environment or via pip install --user, that copy may take priority and report a different version:

which -a ruff

Deactivate the environment or remove the pip copy (pip uninstall ruff) so the packaged /usr/bin/ruff is used, then verify with ruff --version.

Uninstalling

Remove Ruff with:

sudo apt remove ruff

To also remove 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

On Ubuntu, deb.griffo.io makes Ruff a first-class APT package, no pip environments, no Rust toolchain, no manual updates. ruff check and ruff format handle linting and formatting from one fast static binary, and staying current is just part of your regular apt upgrade.

Because Ruff is quick enough to run on every save and every commit, it is easy to fold into both local workflows and CI. Installing it this way keeps that speed within easy reach and always up to date.

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.