Skip to content

UV & Ruff

Version: 1.0.0 | Tests: Passing

devcontainer.json
{
    "features": {
        "ghcr.io/infrashift/trusted-devcontainer-features/uv-ruff:latest": {
            "target_uv_version": "0.10.3",
            "target_ruff_version": "0.15.1"
        }
    }
}
OptionTypeDefaultDescription
target_uv_versionstring0.10.3Select a supported UV version
target_uv_checksumstring""SHA256 checksum for the UV binary
target_ruff_versionstring0.15.1Select a supported Ruff version

None — this feature is independent and has no dependencies.

This feature installs two tools from Astral: UV, a fast Python package manager and project tool, and Ruff, a fast Python linter and formatter. The Ansible playbook first downloads the UV tarball from the official GitHub releases for the specified version, optionally verifies the SHA256 checksum if one is provided via the target_uv_checksum option, and extracts it to ~/.local/bin.

Once UV is installed, the playbook uses it to install Ruff via uv tool install ruff@<version>. This approach leverages UV’s tool management capability to install Ruff in an isolated environment while making the ruff binary available on PATH. The VS Code Ruff extension is recommended for integrated linting and formatting feedback in the editor.

UV serves double duty in this feature collection. It is both an end-user tool for managing Python packages and projects, and the mechanism used by other features to bootstrap their installations. The Python feature uses uv python install to set up managed Python versions, and the ansible-core feature uses uv run to create isolated virtual environments. Because of this foundational role, uv-ruff has no dependencies of its own and sits at the base of the dependency chain for all Python-related features.

Both UV and Ruff are written in Rust and are known for their exceptional speed compared to traditional Python tooling. UV is a drop-in replacement for pip, pip-tools, and virtualenv, while Ruff replaces Flake8, isort, pyupgrade, and dozens of other Python linters with a single tool that runs orders of magnitude faster.