From ae44f687e8e8ed6394d5ec944cab6018bb146ff7 Mon Sep 17 00:00:00 2001 From: chrysle <96722107+chrysle@users.noreply.github.com> Date: Wed, 1 May 2024 16:18:33 +0200 Subject: [PATCH] Fix CI for `pip` 24.1 --- piptools/exceptions.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/piptools/exceptions.py b/piptools/exceptions.py index 3e019a3d1..c056d02af 100644 --- a/piptools/exceptions.py +++ b/piptools/exceptions.py @@ -1,5 +1,6 @@ from __future__ import annotations +import operator from typing import Iterable from pip._internal.index.package_finder import PackageFinder @@ -27,7 +28,9 @@ def __str__(self) -> str: versions = [] pre_versions = [] - for candidate in sorted(self.candidates_tried): + for candidate in sorted( + self.candidates_tried, key=operator.attrgetter("version") + ): version = str(candidate.version) if candidate.version.is_prerelease: pre_versions.append(version)