mirror of
https://github.com/astral-sh/setup-uv.git
synced 2026-11-12 16:53:53 +01:00
## Summary `<=`, `==` and `>` with a partial version are valid PEP 440 specifiers, but the resolver tries them as semver ranges first, and semver reads them differently: | specifier | semver (before) | PEP 440 (what uv enforces) | |---|---|---| | `<=0.5` | `<0.6.0`, installs 0.5.31 | `<=0.5.0`, installs 0.5.0 | | `==0.5` | `==` is stripped and `0.5` is read as `0.5.x`, installs 0.5.31 | `==0.5.0`, installs 0.5.0 | | `>0.5` with `resolution-strategy: lowest` | `>=0.6.0`, installs 0.6.0 | `>0.5.0`, installs 0.5.1 | So `required-version = "<=0.5"` or `"==0.5"` in `uv.toml` / `pyproject.toml` installs a uv that does not satisfy the project's own `required-version`, and uv refuses to run there (`Required uv version ... does not match the running version ...`). This is the same problem #1111 fixed for `~=`. Instead of adding more operators to that check, specifiers that `@renovatebot/pep440` accepts as a valid range now skip the semver evaluation, and `==` is only stripped from a full version, so `==0.5` stays a PEP 440 pin. Notes: - Semver-only syntax is not valid PEP 440 and still goes through semver: `0.4.x`, `^0.5`, `~0.5`, `>=0.4.0 <0.5.0` and a bare `0.5`. - Inputs that are valid in both, like `>=0.4.0` from the docs, now go through PEP 440. They mean the same in both, and the PEP 440 path uses the same first-match lookup over the manifest. - Full pins like `==0.9.26` still resolve as explicit versions, and compound specifiers like `>=0.4,<=0.5` already went through PEP 440. ## Test plan - Added cases for `<=0.9` and `==0.9` with the default strategy and `>0.9` with `lowest` in `download-version.test.ts`. All three fail without the change. - `npm ci --ignore-scripts`, then `npm run build`, `npm run check` (no fixes), `npm run package` and `npm run test:unit` on macOS with Node 24.13.0: 179 tests across 16 suites pass. The rebuilt `dist/setup/index.cjs` only differs in the changed functions. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>