Skip to content

Python

Version: 1.0.0 | Tests: Passing

devcontainer.json
{
    "features": {
        "ghcr.io/infrashift/trusted-devcontainer-features/python:latest": {
            "target_version": "3.12"
        }
    }
}
OptionTypeDefaultDescription
target_versionstring3.12Select a Python version to install
uv-ruffthis feature

This feature uses UV (from the uv-ruff feature) to install a managed Python version. The Ansible playbook runs uv python install <version>, which downloads a standalone Python build from the Astral Python builds project and installs it in UV’s managed location. UV handles the download, extraction, and setup automatically, so no system-level package installation or compilation from source is required.

The dependency on uv-ruff ensures that UV is installed before Python setup begins. When you include the python feature in your devcontainer configuration, the dependency chain installs UV and Ruff first, and then Python is set up at the requested version. This approach provides fast, reproducible Python installations without relying on the system package manager.

The VS Code Python extension is recommended for a full-featured development experience including IntelliSense, debugging, and linting. Since Ruff is already available through the uv-ruff dependency, you get a fast Python linter and formatter out of the box. Other features like ansible-core also depend on this Python feature, so the installed Python version may be shared across multiple tools in the devcontainer.