Skip to content

Installing Ruff#

Ruff は、PyPI のruffとして入手できます。:

$ pip install ruff

インストールしたら、コマンドラインから Ruff を実行できます。:

$ ruff check   # Lint all files in the current directory.
$ ruff format  # Format all files in the current directory.

バージョン0.5.0から、Ruff はスタンドアロンのインストーラでインストールできます。:

$ # On macOS and Linux.
$ curl -LsSf https://astral.sh/ruff/install.sh | sh

$ # On Windows.
$ powershell -c "irm https://astral.sh/ruff/install.ps1 | iex"

$ # For a specific version.
$ curl -LsSf https://astral.sh/ruff/0.5.0/install.sh | sh
$ powershell -c "irm https://astral.sh/ruff/0.5.0/install.ps1 | iex"

macOS HomebrewおよびLinuxbrewユーザーの場合、Ruff は Homebrew のruffとしても利用できます:

$ brew install ruff

Condaユーザーの場合、Ruff はruffonconda-forgeとしても利用できます:

$ conda install -c conda-forge ruff

pkgxユーザーの場合、Ruff はpkgxレジストリのruffとしても利用できます。:

$ pkgx install ruff

Arch Linuxユーザーの場合、Ruff は公式リポジトリのruffからも入手できます。:

$ pacman -S ruff

Alpineユーザーの場合、Ruff はテストリポジトリのruffからも入手できます。:

$ apk add ruff

openSUSE Tumbleweedユーザーの場合、Ruff はディストリビューションリポジトリからも入手できます。:

$ sudo zypper install python3-ruff

Dockerでは、各リリースにはghcr.io/astral-sh/ruffというタグが付けられ、最新リリースにはlatestというタグが付けられて公開されています。

$ docker run -v .:/io --rm ghcr.io/astral-sh/ruff check
$ docker run -v .:/io --rm ghcr.io/astral-sh/ruff:0.3.0 check

$ # Or, for Podman on SELinux.
$ docker run -v .:/io:Z --rm ghcr.io/astral-sh/ruff check

Packaging status