Skip to content

fix: allow whitespace in uv requirement specifiers - #1112

Merged
eifinger merged 2 commits into
astral-sh:mainfrom
soujasK:fix/requirement-specifier-whitespace
Oct 26, 2026
Merged

eifinger merged 2 commits into
astral-sh:mainfrom
soujasK:fix/requirement-specifier-whitespace

Conversation

@soujasK

@soujasK soujasK commented Oct 25, 2026

Copy link
Copy Markdown
Contributor

Summary

When the uv version is read from dependencies (requirements.txt, or project.dependencies / optional-dependencies / dependency-groups in pyproject.toml via version-file), the specifier was matched with /^uv([=<>~!]+\S*)/. PEP 508 allows whitespace around operators and after commas, and those valid forms were misread:

dependency before after
uv >= 0.5.0 not found, latest uv installed >=0.5.0
uv == 0.11.20 not found, latest uv installed ==0.11.20
uv>=0.5.0, <0.6.0 >=0.5.0,, fails with No version found for >=0.5.0, >=0.5.0,<0.6.0

The regex now allows whitespace around operators and between comma-separated clauses, and strips it from the result. Inputs that worked before give the same result, including inline --hash= options, trailing # comments, the \ continuation lines from uv pip compile --generate-hashes, and names that only start with uv (uvicorn, uv-build).

Test plan

  • Added cases for spaced operators, spaced clauses, inline --hash and trailing comments. The four whitespace cases failed before the change.
  • npm run all on Ubuntu (WSL) with Node 24.19.0: build, Biome (no fixes), packaging, and 165 tests across 15 suites pass. The rebuilt dist/setup/index.cjs only differs in the changed line.

PEP 508 allows whitespace around version operators and between clauses.
`uv >= 0.5` was ignored and the latest version installed, and
`uv>=0.5, <0.6` was read as `>=0.5,`, which fails to resolve.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@soujasK
soujasK requested a review from eifinger as a code owner October 25, 2026 17:25
Comment thread src/version/requirements-file.ts Outdated
function getUvVersionFromDependency(dependency: string): string | undefined {
const dependencyWithoutMarker = dependency.split(";", 1)[0]?.trim();
return dependencyWithoutMarker?.match(/^uv([=<>~!]+\S*)/)?.[1].trim();
// PEP 508 allows whitespace around operators and between clauses, e.g. "uv >= 0.5, < 0.6"

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.

Please remove this comment. It is an explanation for the change we made that belongs in a commit message body or the PR description.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Removed, thanks.

@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.

Thank you! 🚀

@eifinger
eifinger merged commit 9c73321 into astral-sh:main Oct 26, 2026
91 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
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