Fix: Allow packages with only prerelease versions to be installed#6486
Merged
Fix: Allow packages with only prerelease versions to be installed#6486
Conversation
4dc953f to
aeb4ea6
Compare
This fixes issue #6485 where packages like opentelemetry-semantic-conventions that only have prerelease versions (e.g., 0.60b0) could not be installed without using the --pre flag. The fix modifies get_applicable_candidates() in the package finder to: 1. First filter with prereleases=False (to prevent #6395 regression) 2. If no stable versions match AND candidates exist, retry with prereleases=None to allow PEP 440's fallback behavior This preserves the fix for #6395 (transitive dependencies with prerelease specifiers don't enable prereleases for all packages) while allowing packages that genuinely only have prerelease versions to be installed. Fixes #6485
- Sort imports alphabetically (I001) - Add newline at end of file (W292)
The patch file was malformed with incorrect line numbers and missing context lines. Regenerated the patch using git diff to ensure proper format that can be applied during vendoring.
aeb4ea6 to
7a113f0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR fixes issue #6485 where packages like
opentelemetry-semantic-conventionsthat only have prerelease versions (e.g.,0.60b0) could not be installed without using the--preflag.Problem
The fix for #6395 changed the prerelease handling to use
prereleases=Falseinstead ofprereleases=None. This correctly prevented transitive dependencies with prerelease specifiers from enabling prereleases globally, but it also broke packages that have only prerelease versions available.Per PEP 440, when no stable versions satisfy the constraints, prereleases should be considered. The previous fix explicitly disabled this fallback behavior.
Solution
The fix modifies
get_applicable_candidates()in the package finder to:prereleases=False(to prevent locking to prerelease version without--prebeing used #6395 regression)prereleases=Noneto allow PEP 440's fallback behaviorThis preserves the fix for #6395 (transitive dependencies with prerelease specifiers don't enable prereleases for all packages) while allowing packages that genuinely only have prerelease versions to be installed.
Testing
Added unit tests in
tests/unit/test_dependencies.pyto verify:--preflag works as expectedFixes #6485
Pull Request opened by Augment Code with guidance from the PR author