Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 11, 2025

Adds a new resolution-strategy input that allows users to choose between installing the highest (default) or lowest compatible version when resolving version ranges.

Closes: #620

Problem

When specifying version constraints like >=0.4.0, setup-uv would always install the latest compatible version. This made it difficult to test against the minimum supported uv version to catch compatibility issues early, similar to how uv --resolution-strategy lowest works.

Solution

This PR introduces a new resolution-strategy input with two options:

  • "highest" (default): Install the latest version that satisfies constraints - maintains existing behavior
  • "lowest": Install the oldest version that satisfies constraints - new functionality

Usage Examples

Test with minimum supported version:

- name: Install oldest compatible uv version
  uses: astral-sh/setup-uv@v6
  with:
    version: ">=0.4.0"
    resolution-strategy: "lowest"

Matrix testing with both strategies:

strategy:
  matrix:
    resolution-strategy: ["highest", "lowest"]
steps:
  - uses: astral-sh/setup-uv@v6
    with:
      version: ">=0.4.0"
      resolution-strategy: ${{ matrix.resolution-strategy }}
      cache-suffix: ${{ matrix.resolution-strategy }}

Implementation Details

  • Input validation: Validates strategy values with clear error messages
  • Version resolution: Extended resolveVersion() to support both semver and PEP 440 specifications using minSatisfying/maxSatisfying functions
  • Backward compatibility: Existing workflows continue working unchanged
  • Documentation: Updated README with usage examples and FAQ section reference

Testing

  • Extended the test-specific-version job in .github/workflows/test.yml with matrix testing for both resolution strategies
  • Added test cases using version ranges like >=0.4.25,<0.5 and >=0.1.0,<0.2 to verify both highest and lowest resolution behavior
  • Integration testing validates the feature works correctly with real version resolution scenarios

This enables users to test their configurations against the minimum supported uv version, helping catch cases where newer uv features are required than declared in version constraints.

Fixes #620

Original prompt

Implemented the changes requested in @astral-sh/setup-uv/issues/620

Add a new input resolution-strategy. The default is "highest" the other supported option is "lowest"


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Add resolution strategy input with default option Add resolution-strategy input to support oldest compatible version selection Oct 11, 2025
Copilot AI requested a review from eifinger October 11, 2025 17:34
Copy link
Collaborator

@eifinger eifinger left a comment

Choose a reason for hiding this comment

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

@copilot remove all the unit tests you added in the __tests__ folder. They are not testing any code and are thus useless.

Extend the test test-specific-version in .github/workflows/test.yml instead. Add an additional input in the matrix for the resolution strategy. Look in version-manifest.json for available versions

Copy link
Contributor Author

Copilot AI commented Oct 11, 2025

@copilot remove all the unit tests you added in the __tests__ folder. They are not testing any code and are thus useless.

Extend the test test-specific-version in .github/workflows/test.yml i...

Removed all unit tests from __tests__ folder and extended the test-specific-version job with resolution strategy matrix testing. Added test cases for both highest and lowest strategies using version ranges like >=0.4.25,<0.5 and >=0.1.0,<0.2 to verify the resolution behavior works correctly. Commit: a7a9e23

Copilot AI requested a review from eifinger October 11, 2025 18:32
Copilot finished work on behalf of eifinger October 11, 2025 18:32
@eifinger eifinger force-pushed the copilot/add-resolution-strategy-input branch from be6e5ca to c6dcfa6 Compare October 11, 2025 18:57
@eifinger eifinger marked this pull request as ready for review October 11, 2025 19:00
@eifinger eifinger merged commit 9c6b5e9 into main Oct 11, 2025
88 checks passed
@eifinger eifinger deleted the copilot/add-resolution-strategy-input branch October 11, 2025 19:02
@eifinger eifinger added the enhancement New feature or request label Oct 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

resolve to oldest compatible uv version

2 participants