community.general.uv_python module – Manage Python versions and installations using the uv Python package manager
Note
This module is part of the community.general collection (version 13.1.0).
You might already have this collection installed if you are using the ansible package.
It is not included in ansible-core.
To check whether it is installed, run ansible-galaxy collection list.
To install it, use: ansible-galaxy collection install community.general.
You need further requirements to be able to use this module,
see Requirements for details.
To use it in a playbook, specify: community.general.uv_python.
New in community.general 13.0.0
Synopsis
Install, uninstall or upgrade Python versions managed by
uv.
Requirements
The below requirements are needed on the host that executes this module.
uvmust be installed and available inPATHand must be at least 0.8.0.
Parameters
Parameter |
Comments |
|---|---|
Desired state of the specified Python version.
Choices:
|
|
Python version to manage. Not all canonical Python versions are supported in this release. Valid version numbers consist of two or three dot-separated numeric components, with an optional ‘pre-release’ tag at the end such as Advanced uv selectors such as When you specify only a major.minor version, make sure the number is enclosed in quotes so that it gets parsed correctly. Note that in case only a major.minor version are specified behavior depends on the |
Attributes
Attribute |
Support |
Description |
|---|---|---|
Support: full |
Can run in |
|
Support: none |
Returns details on what has changed (or possibly needs changing in |
See Also
See also
- C(uv) documentation
Python versions management with
uv.- C(uv) CLI documentation
uvCLI reference guide.
Examples
- name: Install Python 3.14
community.general.uv_python:
version: "3.14"
- name: Upgrade Python 3.14
community.general.uv_python:
version: "3.14"
state: latest
- name: Remove Python 3.13.5
community.general.uv_python:
version: 3.13.5
state: absent
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
|---|---|
List of installation paths of Python versions changed. Returned: success Sample: |
|
List of Python versions changed. Returned: success Sample: |
|
Return code of the executed command. Returned: success Sample: |
|
Stderr of the executed command. Returned: success Sample: |
|
Stdout of the executed command. Returned: success Sample: |