Skip to content

fix: resolve ~= specifiers with PEP 440 semantics - #1111

Merged
eifinger merged 1 commit into
astral-sh:mainfrom
soujasK:fix/pep440-compatible-release
Oct 25, 2026
Merged

eifinger merged 1 commit into
astral-sh:mainfrom
soujasK:fix/pep440-compatible-release

Conversation

@soujasK

@soujasK soujasK commented Oct 25, 2026

Copy link
Copy Markdown
Contributor

Summary

~= is the PEP 440 compatible release operator, but the resolver tries semver.validRange() first, and semver accepts ~= as a tilde range:

specifier semver PEP 440
~=0.9 >=0.9.0 <0.10.0 >=0.9, ==0.*

So with the default highest strategy, version: "~=0.9" (or required-version = "~=0.9" picked up through version-file) installs the highest 0.9.x instead of the highest 0.x. The same happens with manifest-file, where tc.evaluateVersions is semver-based.

This skips the semver evaluation for specifiers containing ~=, so they are only evaluated with @renovatebot/pep440. No semver range legitimately uses ~=.

Notes:

  • Only a bare two-segment ~=X.Y resolved incorrectly. ~=X.Y.Z gives the same result in both, and compound specifiers like ~=0.9, !=0.9.3 were already rejected by semver and fell through to PEP 440.
  • minSatisfying gets the same check for consistency. The lower bound is the same under both interpretations, so lowest didn't produce wrong results before.
  • A single-segment ~=1 is invalid PEP 440. semver used to resolve it to 1.x; it now fails with No version found for ~=1, same as other invalid specifiers.

Test plan

  • Added tests for ~=0.9 with the default manifest and with manifest-file. Both returned 0.9.26 instead of 0.10.2 before the change.
  • npm run all on Ubuntu (WSL) with Node 24.19.0: build, Biome (no fixes), packaging, and 161 tests across 15 suites pass. The rebuilt dist/setup/index.cjs only differs in the changed lines.

semver accepts `~=` as a tilde range, so `~=0.9` was resolved as
`>=0.9.0 <0.10.0` instead of PEP 440's `>=0.9, ==0.*`, and the highest
strategy never picked versions beyond 0.9.x. Only evaluate `~=` as PEP 440.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@soujasK
soujasK requested a review from eifinger as a code owner October 25, 2026 16:35

@eifinger eifinger left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Nice, thank you!

@eifinger
eifinger merged commit 80fbe01 into astral-sh:main Oct 25, 2026
90 checks passed
luketainton pushed a commit to luketainton/luke_rsu that referenced this pull request Oct 28, 2026
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [astral-sh/setup-uv](https://github.com/astral-sh/setup-uv) | action | patch | `v10.3.2` → `v10.3.3` |

---

### Release Notes

<details>
<summary>astral-sh/setup-uv</summary>

### [`v10.3.3`](https://github.com/astral-sh/setup-uv/releases/tag/v10.3.3): 🌈 Use Astral mirror for version manifests with GitHub fallback

[Compare Source](astral-sh/setup-uv@v10.3.2...v10.3.3)

##### Changes

This release contains something that should have been included a very long time ago. Sorry for sleeping on that.

This action now retrieves the release manifest that contains the available versions, their download links and checksums from the Astral mirror, rather than trying GitHub first. This should present much more stable.
(Known checksums are still checked, so the security impact does not change)

Also a big thank you to [@&#8203;soujasK](https://github.com/soujasK) for a set of bugfixes 👏

##### 🐛 Bug fixes

- Use Astral mirror for version manifests with GitHub fallback [@&#8203;eifinger](https://github.com/eifinger) ([#&#8203;1119](astral-sh/setup-uv#1119))
- fix: allow whitespace in uv requirement specifiers [@&#8203;soujasK](https://github.com/soujasK) ([#&#8203;1112](astral-sh/setup-uv#1112))
- fix: resolve \~= specifiers with PEP 440 semantics [@&#8203;soujasK](https://github.com/soujasK) ([#&#8203;1111](astral-sh/setup-uv#1111))
- fix: only report a saved cache when saving succeeded [@&#8203;soujasK](https://github.com/soujasK) ([#&#8203;1110](astral-sh/setup-uv#1110))

##### 🧰 Maintenance

- chore: update known checksums for 0.13.6 @&#8203;[github-actions\[bot\]](https://github.com/apps/github-actions) ([#&#8203;1117](astral-sh/setup-uv#1117))

##### 📚 Documentation

- docs: use JSDoc for compatible release specifier comment [@&#8203;eifinger](https://github.com/eifinger) ([#&#8203;1113](astral-sh/setup-uv#1113))
- docs: update version references to v10.3.2 @&#8203;[github-actions\[bot\]](https://github.com/apps/github-actions) ([#&#8203;1104](astral-sh/setup-uv#1104))

</details>

---

### Configuration

📅 **Schedule**: (UTC)

- Branch creation
  - At any time (no schedule defined)
- Automerge
  - At any time (no schedule defined)

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Mend Renovate CLI](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0NC4xOTAuMCIsInVwZGF0ZWRJblZlciI6IjQ0LjE5MC4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJ0eXBlL2RlcGVuZGVuY2llcyJdfQ==-->

Reviewed-on: https://git.tainton.uk/repos/rsu/pulls/64
Co-authored-by: renovate[bot] <renovate-bot@git.tainton.uk>
luketainton pushed a commit to luketainton/repos_labmcp that referenced this pull request Oct 28, 2026
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [astral-sh/setup-uv](https://github.com/astral-sh/setup-uv) | action | patch | `v10.3.2` → `v10.3.3` |

---

### Release Notes

<details>
<summary>astral-sh/setup-uv</summary>

### [`v10.3.3`](https://github.com/astral-sh/setup-uv/releases/tag/v10.3.3): 🌈 Use Astral mirror for version manifests with GitHub fallback

[Compare Source](astral-sh/setup-uv@v10.3.2...v10.3.3)

##### Changes

This release contains something that should have been included a very long time ago. Sorry for sleeping on that.

This action now retrieves the release manifest that contains the available versions, their download links and checksums from the Astral mirror, rather than trying GitHub first. This should present much more stable.
(Known checksums are still checked, so the security impact does not change)

Also a big thank you to [@&#8203;soujasK](https://github.com/soujasK) for a set of bugfixes 👏

##### 🐛 Bug fixes

- Use Astral mirror for version manifests with GitHub fallback [@&#8203;eifinger](https://github.com/eifinger) ([#&#8203;1119](astral-sh/setup-uv#1119))
- fix: allow whitespace in uv requirement specifiers [@&#8203;soujasK](https://github.com/soujasK) ([#&#8203;1112](astral-sh/setup-uv#1112))
- fix: resolve \~= specifiers with PEP 440 semantics [@&#8203;soujasK](https://github.com/soujasK) ([#&#8203;1111](astral-sh/setup-uv#1111))
- fix: only report a saved cache when saving succeeded [@&#8203;soujasK](https://github.com/soujasK) ([#&#8203;1110](astral-sh/setup-uv#1110))

##### 🧰 Maintenance

- chore: update known checksums for 0.13.6 @&#8203;[github-actions\[bot\]](https://github.com/apps/github-actions) ([#&#8203;1117](astral-sh/setup-uv#1117))

##### 📚 Documentation

- docs: use JSDoc for compatible release specifier comment [@&#8203;eifinger](https://github.com/eifinger) ([#&#8203;1113](astral-sh/setup-uv#1113))
- docs: update version references to v10.3.2 @&#8203;[github-actions\[bot\]](https://github.com/apps/github-actions) ([#&#8203;1104](astral-sh/setup-uv#1104))

</details>

---

### Configuration

📅 **Schedule**: (UTC)

- Branch creation
  - At any time (no schedule defined)
- Automerge
  - At any time (no schedule defined)

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Mend Renovate CLI](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0NC4xOTAuMCIsInVwZGF0ZWRJblZlciI6IjQ0LjE5MC4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJ0eXBlL2RlcGVuZGVuY2llcyJdfQ==-->

Reviewed-on: https://git.tainton.uk/repos/labmcp/pulls/87
Reviewed-by: Luke Tainton <luke@tainton.uk>
Co-authored-by: renovate[bot] <renovate-bot@git.tainton.uk>
Doridian pushed a commit to FoxDenHome/core that referenced this pull request Oct 28, 2026
…10.3.3 (#288)

This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [https://github.com/astral-sh/setup-uv](https://github.com/astral-sh/setup-uv) | action | patch | `v10.3.2` → `v10.3.3` |

---

### Release Notes

<details>
<summary>astral-sh/setup-uv (https://github.com/astral-sh/setup-uv)</summary>

### [`v10.3.3`](https://github.com/astral-sh/setup-uv/releases/tag/v10.3.3): 🌈 Use Astral mirror for version manifests with GitHub fallback

[Compare Source](astral-sh/setup-uv@v10.3.2...v10.3.3)

#### Changes

This release contains something that should have been included a very long time ago. Sorry for sleeping on that.

This action now retrieves the release manifest that contains the available versions, their download links and checksums from the Astral mirror, rather than trying GitHub first. This should present much more stable.
(Known checksums are still checked, so the security impact does not change)

Also a big thank you to [@&#8203;soujasK](https://github.com/soujasK) for a set of bugfixes 👏

#### 🐛 Bug fixes

- Use Astral mirror for version manifests with GitHub fallback [@&#8203;eifinger](https://github.com/eifinger) ([#&#8203;1119](astral-sh/setup-uv#1119))
- fix: allow whitespace in uv requirement specifiers [@&#8203;soujasK](https://github.com/soujasK) ([#&#8203;1112](astral-sh/setup-uv#1112))
- fix: resolve \~= specifiers with PEP 440 semantics [@&#8203;soujasK](https://github.com/soujasK) ([#&#8203;1111](astral-sh/setup-uv#1111))
- fix: only report a saved cache when saving succeeded [@&#8203;soujasK](https://github.com/soujasK) ([#&#8203;1110](astral-sh/setup-uv#1110))

#### 🧰 Maintenance

- chore: update known checksums for 0.13.6 @&#8203;[github-actions\[bot\]](https://github.com/apps/github-actions) ([#&#8203;1117](astral-sh/setup-uv#1117))

#### 📚 Documentation

- docs: use JSDoc for compatible release specifier comment [@&#8203;eifinger](https://github.com/eifinger) ([#&#8203;1113](astral-sh/setup-uv#1113))
- docs: update version references to v10.3.2 @&#8203;[github-actions\[bot\]](https://github.com/apps/github-actions) ([#&#8203;1104](astral-sh/setup-uv#1104))

</details>

---

### Configuration

📅 **Schedule**: (in timezone America/Los_Angeles)

- Branch creation
  - At any time (no schedule defined)
- Automerge
  - At any time (no schedule defined)

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Mend Renovate CLI](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0NC4xOTAuMCIsInVwZGF0ZWRJblZlciI6IjQ0LjE5MC4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119-->

Reviewed-on: https://git.foxden.network/FoxDen/core/pulls/288
eifinger pushed a commit that referenced this pull request Nov 12, 2026
## 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>
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