From 261f1b301a8bc114fa727c6c38cc7af9257746d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9rome=20Eertmans?= Date: Wed, 27 Dec 2023 11:52:38 +0100 Subject: [PATCH 1/2] chore(lib): enhance warning message Closes #2522. --- src/pdm/models/repositories.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/pdm/models/repositories.py b/src/pdm/models/repositories.py index 85e2ab868f..28f95cb403 100644 --- a/src/pdm/models/repositories.py +++ b/src/pdm/models/repositories.py @@ -196,9 +196,13 @@ def python_specifier(spec: str | PySpecSet) -> str: if working_requires_python.is_impossible: # pragma: no cover continue warnings.warn( - f"Skipping {candidate.name}@{candidate.version} because it requires " + f"Could not install the latest available version for {candidate.name} " + f"(i.e., {candidate.name}@{candidate.version}) because it requires " f"{python_specifier(candidate.requires_python)} but the project claims to work with " - f"{python_specifier(project_requires_python)}.\nNarrow down the `requires-python` range to " + f"{python_specifier(project_requires_python)}. Instead, the latest version of " + f"{candidate.name} that supports {python_specifier(project_requires_python)} will " + f"be installed.\nIf you want to install {candidate.name}@{candidate.version}, " + "narrow down the `requires-python` range to " f'include this version. For example, "{working_requires_python}" should work.', PackageWarning, stacklevel=4, From af9abcf40f55374f5077b7d7dd0635ce02deaa5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9rome=20Eertmans?= Date: Thu, 28 Dec 2023 12:04:17 +0100 Subject: [PATCH 2/2] chore(lib): fix message to be more correct --- src/pdm/models/repositories.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/pdm/models/repositories.py b/src/pdm/models/repositories.py index 28f95cb403..458fa33a54 100644 --- a/src/pdm/models/repositories.py +++ b/src/pdm/models/repositories.py @@ -196,12 +196,11 @@ def python_specifier(spec: str | PySpecSet) -> str: if working_requires_python.is_impossible: # pragma: no cover continue warnings.warn( - f"Could not install the latest available version for {candidate.name} " - f"(i.e., {candidate.name}@{candidate.version}) because it requires " + f"Skipping {candidate.name}@{candidate.version} because it requires " f"{python_specifier(candidate.requires_python)} but the project claims to work with " - f"{python_specifier(project_requires_python)}. Instead, the latest version of " + f"{python_specifier(project_requires_python)}. Instead, another version of " f"{candidate.name} that supports {python_specifier(project_requires_python)} will " - f"be installed.\nIf you want to install {candidate.name}@{candidate.version}, " + f"be used.\nIf you want to install {candidate.name}@{candidate.version}, " "narrow down the `requires-python` range to " f'include this version. For example, "{working_requires_python}" should work.', PackageWarning,