Skip to content

refactor(resolver): return lists of matching versions#975

Open
rd4398 wants to merge 1 commit intopython-wheel-build:mainfrom
rd4398:resolver-return-multiple-values
Open

refactor(resolver): return lists of matching versions#975
rd4398 wants to merge 1 commit intopython-wheel-build:mainfrom
rd4398:resolver-return-multiple-values

Conversation

@rd4398
Copy link
Contributor

@rd4398 rd4398 commented Mar 23, 2026

This commit refactors resolution layer to return all matching versions instead of a single
version, laying the groundwork for multiple version bootstrap support.

Changes:

  • resolver.resolve() and resolve_from_provider() now return list[tuple[str, Version]] instead of single tuple, sorted by version (highest first)
  • sources.resolve_source() returns all matching source versions as list
  • wheels.resolve_prebuilt_wheel() returns all matching wheel versions as list
  • RequirementResolver methods updated to handle and cache lists
  • Bootstrapper.resolve_version() picks highest version ([0]) maintaining exact backward compatibility
  • Graph resolution (_resolve_from_graph) returns all matching versions from previous bootstrap
  • Cache keys remain (requirement_string, pre_built) but now store full lists

@rd4398 rd4398 requested a review from a team as a code owner March 23, 2026 19:22
@rd4398 rd4398 changed the title refactor(resolver): return lists of matching versions for multi-versi… refactor(resolver): return lists of matching versions Mar 23, 2026
@mergify mergify bot added the ci label Mar 23, 2026
@rd4398 rd4398 requested review from EmilienM and dhellmann March 23, 2026 19:23
@rd4398 rd4398 marked this pull request as draft March 23, 2026 19:31
This commit refactors resolution layer to return all matching versions instead of a single
  version, laying the groundwork for multiple version bootstrap support.

Changes:
  - resolver.resolve() and resolve_from_provider() now return list[tuple[str, Version]]
    instead of single tuple, sorted by version (highest first)
  - sources.resolve_source() returns all matching source versions as list
  - wheels.resolve_prebuilt_wheel() returns all matching wheel versions as list
  - RequirementResolver methods updated to handle and cache lists
  - Bootstrapper.resolve_version() picks highest version ([0]) maintaining exact
    backward compatibility
  - Graph resolution (_resolve_from_graph) returns all matching versions from
    previous bootstrap
  - Cache keys remain (requirement_string, pre_built) but now store full lists

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

Signed-off-by: Rohan Devasthale <rdevasth@redhat.com>
@rd4398 rd4398 force-pushed the resolver-return-multiple-values branch from 31d3717 to 8fe05f7 Compare March 23, 2026 19:42
@rd4398 rd4398 marked this pull request as ready for review March 23, 2026 19:56
@tiran
Copy link
Collaborator

tiran commented Mar 24, 2026

The PR changes a lot of code and introduces an API-incompatible change.

Alternative:

  • introduce a new function that returns a list of candidates
  • change the existing functions to call the new function and only return the first match

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants