-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Add back ignore_compatibility option to pip package finder for comprehensive lock file generation #6426
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR restores the lost ignore_compatibility
flag in Pipenv’s vendored Pip LinkEvaluator
and PackageFinder
to allow lock-file generation across all platforms.
- Adds
ignore_compatibility
parameter toLinkEvaluator
and skips compatibility checks when enabled - Extends
PackageFinder
with the same flag, updates sorting to handle unsupported wheels, and propagates the flag to link evaluation - Provides a vendoring patch file and adds a news fragment
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
tasks/vendoring/patches/patched/pip_finder_ignore_compatability.patch | Vendoring patch adding ignore_compatibility logic |
pipenv/patched/pip/_internal/index/package_finder.py | Implements ignore_compatibility in evaluator and sorter |
news/6426.bugfix.rst | News entry for restored compatibility option |
Comments suppressed due to low confidence (1)
tasks/vendoring/patches/patched/pip_finder_ignore_compatability.patch:1
- The filename
pip_finder_ignore_compatability.patch
has a typo in "compatability". Rename it topip_finder_ignore_compatibility.patch
to prevent vendoring/apply-script failures.
--- a/pipenv/patched/pip/_internal/index/package_finder.py
@@ -135,6 +135,7 @@ def __init__( | |||
target_python: TargetPython, | |||
allow_yanked: bool, | |||
ignore_requires_python: Optional[bool] = None, | |||
ignore_compatibility: Optional[bool] = None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] For consistency with how ignore_requires_python
is handled, initialize ignore_compatibility
to False when it's None (e.g., if ignore_compatibility is None: ignore_compatibility = False
). This avoids relying on truthiness of None.
Copilot uses AI. Check for mistakes.
@@ -473,7 +476,11 @@ def get_applicable_candidates( | |||
|
|||
return sorted(filtered_applicable_candidates, key=self._sort_key) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new ignore_compatibility
parameter on _sort_key
is never passed when sorting (sorted(..., key=self._sort_key)
), so it always uses the default True. Update the sort call to key=lambda c: self._sort_key(c, self._ignore_compatibility)
to honor the instance flag.
return sorted(filtered_applicable_candidates, key=self._sort_key) | |
return sorted(filtered_applicable_candidates, key=lambda c: self._sort_key(c, self._ignore_compatibility)) |
Copilot uses AI. Check for mistakes.
The issue
This patch was mistakenly dropped during the last pip vendoring update, which caused #6423
Add ignore_compatibility option to pip package finder for comprehensive lock file generation
Summary
This PR restores and formalizes the
ignore_compatibility
patch for pip's package finder, enabling Pipenv to include all relevant package hashes in lock files regardless of platform compatibility constraints.Problem
Currently, pip's package finder filters out packages based on platform compatibility (wheel tags, Python version requirements, etc.), which prevents Pipenv from generating comprehensive lock files that include hashes for all platforms. This creates issues when:
Solution
This patch adds an
ignore_compatibility
parameter to bothLinkEvaluator
andPackageFinder
classes that:"binary"
is not in accepted formatsChanges
ignore_compatibility
parameter toLinkEvaluator.__init__()
evaluate_link()
to conditionally skip compatibility checks_sort_key()
to handle unsupported wheels without raising exceptionsignore_compatibility
parameter toPackageFinder.__init__()
Impact
This enables Pipenv to generate lock files with comprehensive hash coverage across all platforms while maintaining backward compatibility (defaults to
False
).Files changed:
pipenv/patched/pip/_internal/index/package_finder.py
tasks/vendoring/patches/patched/pip_finder_ignore_compatability.patch
The checklist
news/
directory to describe this fix with the extension.bugfix.rst
,.feature.rst
,.behavior.rst
,.doc.rst
..vendor.rst
. or.trivial.rst
(this will appear in the release changelog). Use semantic line breaks and name the file after the issue number or the PR #.