Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(lib): enhance warning message #2523

Merged
merged 2 commits into from
Jan 2, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/pdm/models/repositories.py
Original file line number Diff line number Diff line change
Expand Up @@ -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} "
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But it may not be the latest version, this is not accurate.

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,
Expand Down