Tested on Fedora 40 with Podman 5.1.1 and ruff "0.5.0" and "latest". source: https://unix.stackexchange.com/q/651198 ## Error without fix ```` $ podman run --rm -it -v .:/io ghcr.io/astral-sh/ruff:latest check error: Failed to initialize cache at /io/.ruff_cache: Permission denied (os error 13) warning: Encountered error: Permission denied (os error 13) All checks passed! $ podman run --rm -it -v .:/io ghcr.io/astral-sh/ruff:latest format error: Failed to initialize cache at /io/.ruff_cache: Permission denied (os error 13) error: Encountered error: Permission denied (os error 13) ```` ## Summary Running ruff by using a docker container requires `:Z` when mounting the current directory on Fedora with SELinux and Podman. ## Test Plan ```` $ podman run --rm -it -v .:/io:Z ghcr.io/astral-sh/ruff:latest check $ podman run --rm -it -v .:/io:Z ghcr.io/astral-sh/ruff:0.5.0 check ````
2.1 KiB
Installing Ruff
Ruff is available as ruff on PyPI:
pip install ruff
Once installed, you can run Ruff from the command line:
ruff check # Lint all files in the current directory.
ruff format # Format all files in the current directory.
Starting with version 0.5.0, Ruff can be installed with our standalone installers:
# 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"
For macOS Homebrew and Linuxbrew users, Ruff is also available as ruff
on Homebrew:
brew install ruff
For Conda users, Ruff is also available as ruff on
conda-forge:
conda install -c conda-forge ruff
For pkgx users, Ruff is also available as ruff
on the pkgx registry:
pkgx install ruff
For Arch Linux users, Ruff is also available as ruff
on the official repositories:
pacman -S ruff
For Alpine users, Ruff is also available as ruff
on the testing repositories:
apk add ruff
For openSUSE Tumbleweed users, Ruff is also available in the distribution repository:
sudo zypper install python3-ruff
On Docker, it is published as ghcr.io/astral-sh/ruff, tagged for each release and latest for
the latest release.
If you use Podman and SELinux, mount the current directory by using .:/io:Z.
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