From d37009ae7b242a33871593b3b1091bf6c0c06551 Mon Sep 17 00:00:00 2001 From: Mariam Ahhttouche Date: Mon, 16 Feb 2026 10:04:38 +0100 Subject: [PATCH] uv_python module: update latest state handling to sort versions without relying on uv behavior --- plugins/modules/uv_python.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/plugins/modules/uv_python.py b/plugins/modules/uv_python.py index 67640fc1cf..cccb6f3d92 100644 --- a/plugins/modules/uv_python.py +++ b/plugins/modules/uv_python.py @@ -103,7 +103,7 @@ class UV: detected_version = out.split()[0] latest_version = self._get_latest_patch_release() if rc == 0 and detected_version == latest_version: - return False, out + return False, latest_version if self.module.check_mode: return True, latest_version @@ -124,9 +124,10 @@ class UV: return rc, out, err def _get_latest_patch_release(self): - _, out, _ = self._list_python() - result = json.loads(out) - return result[0]["version"] # uv orders versions in descending order + _, out, _ = self._list_python() # uv returns versions in descending order but we sort them just in case future uv behavior changes + results = json.loads(out) + versions = [StrictVersion(result["version"]) for result in results] + return max(versions).__str__() def main():