Fix explicit-priority sources not checked by poetry show --outdated - #10982
Merged
radoering merged 2 commits intoAug 1, 2026
Merged
Conversation
pctablet505
marked this pull request as ready for review
July 17, 2026 12:47
Sanjays2402
reviewed
Jul 18, 2026
`poetry show --outdated` looks up the latest version of each locked package via VersionSelector, but find_latest_package() never passed along the dependency's configured source. RepositoryPool.find_packages only falls back to a named repository when a source is given, and repositories with priority = "explicit" are excluded from the default search, so packages pinned to an explicit source were never reported as outdated. Pass the dependency's source name through so explicit repositories are consulted for their own packages, matching the behavior already used by `poetry init`/`poetry add`. Fixes python-poetry#10425
A package may be declared with multiple constraints carrying different markers and sources (e.g. one constraint per platform, each pinned to a different explicit source). The latest-version lookup for `poetry show --outdated` previously used the source of the first matching dependency, which is ambiguous and can pick the wrong source when several constraints exist for the same package name. Instead, read the source from the locked package's own `source_reference`, which unambiguously identifies the source of the constraint that was actually resolved for the current environment. This also simplifies the code by dropping the per-dependency source lookup.
radoering
force-pushed
the
fix/show-outdated-explicit-source
branch
from
August 1, 2026 07:51
314fb29 to
9d01e03
Compare
radoering
approved these changes
Aug 1, 2026
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.
Problem
When a dependency is pinned to a repository with
priority = "explicit",poetry show --outdatednever reports it as outdated, even when a newer version exists in that repository.Root cause
ShowCommand.find_latest_packagelooks up each locked package's matchingDependencyto readallow_prereleases, but discards the dependency'ssource_namebefore callingVersionSelector.find_best_candidate. Without asource,RepositoryPool.find_packagesfalls back to searchingself.repositories, which intentionally excludes repositories withPriority.EXPLICIT(see therepositoriesproperty docstring inrepository_pool.py). So a package that only exists in an explicit repository is silently skipped.Fix
Pass the dependency's
source_namethrough tofind_best_candidate, the same waypoetry init/poetry addalready do (ConsoleCommand._find_best_version_for_package). This letsRepositoryPool.find_packagesresolve the specific named repository directly, bypassing the explicit-repo exclusion just for that lookup, exactly as intended for a dependency pinned to a source.Testing
Added
test_show_outdated_explicit_sourcecovering a dependency sourced from an explicit-priority repository. Confirmed it fails with the old code (PackageNotFoundError, since the explicit repo is never consulted) and passes with the fix.Fixes #10425