Skip to content

Comments

Validate URL wheel tags against Requires-Python and required environments#16824

Merged
charliermarsh merged 2 commits intomainfrom
charlie/req
Nov 26, 2025
Merged

Validate URL wheel tags against Requires-Python and required environments#16824
charliermarsh merged 2 commits intomainfrom
charlie/req

Conversation

@charliermarsh
Copy link
Member

Summary

Closes #16818.

@charliermarsh charliermarsh added the bug Something isn't working label Nov 23, 2025
@charliermarsh charliermarsh marked this pull request as ready for review November 23, 2025 21:08
----- stderr -----
× No solution found when resolving dependencies:
╰─▶ Because only numpy==2.3.5 is available and numpy==2.3.5 has no wheels with a matching Python version tag (e.g., `cp312`), we can conclude that all versions of numpy cannot be used.
And because your project depends on numpy, we can conclude that your project's requirements are unsatisfiable.
Copy link
Member Author

Choose a reason for hiding this comment

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

Today, this resolution passes and the wheel is just omitted from the lockfile.

----- stderr -----
× No solution found when resolving dependencies:
╰─▶ Because only numpy==2.3.5 is available and numpy==2.3.5 has no Windows-compatible wheels, we can conclude that all versions of numpy cannot be used.
And because your project depends on numpy, we can conclude that your project's requirements are unsatisfiable.
Copy link
Member Author

Choose a reason for hiding this comment

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

Same here -- this passes too.

Copy link
Member

@konstin konstin left a comment

Choose a reason for hiding this comment

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

One question about the resolver order, otherwise looks good.

for environment_marker in self.options.required_environments.iter().copied() {
// If the platform is part of the current environment...
if env.included_by_marker(environment_marker)
&& !find_environments(id, pubgrub).is_disjoint(environment_marker)
Copy link
Member

Choose a reason for hiding this comment

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

Here, we compute through which marker paths the package is currently reachable. Doesn't that mean we can miss an incompatible package if the dependency with a wider marker only appears later?

Copy link
Member Author

Choose a reason for hiding this comment

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

Hmm, maybe? But I think this is the same strategy as in the choose_version_registry path`.

Copy link
Member

Choose a reason for hiding this comment

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

It looks like we're getting saved by pseudo-packages having their version selection, with this PR this fails as it should:

[project]
name = "test-toml"
version = "0.1.0"
requires-python = ">=3.14"
dependencies = [
    'numpy; sys_platform == "win32"',
    'pandas',
]

[tool.uv]
required-environments = ['sys_platform == "linux"', 'sys_platform == "win32"']

[tool.uv.sources]
numpy = { url = "https://files.pythonhosted.org/packages/a3/2e/235b4d96619931192c91660805e5e49242389742a7a82c27665021db690c/numpy-2.3.5-cp314-cp314-win_amd64.whl" }

@charliermarsh charliermarsh merged commit bfdee80 into main Nov 26, 2025
102 checks passed
@charliermarsh charliermarsh deleted the charlie/req branch November 26, 2025 01:06
tmeijn pushed a commit to tmeijn/dotfiles that referenced this pull request Nov 27, 2025
This MR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [astral-sh/uv](https://github.com/astral-sh/uv) | patch | `0.9.11` -> `0.9.13` |

MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot).

**Proposed changes to behavior should be submitted there as MRs.**

---

### Release Notes

<details>
<summary>astral-sh/uv (astral-sh/uv)</summary>

### [`v0.9.13`](https://github.com/astral-sh/uv/blob/HEAD/CHANGELOG.md#0913)

[Compare Source](astral-sh/uv@0.9.12...0.9.13)

Released on 2025-11-26.

##### Bug fixes

- Revert "Allow `--with-requirements` to load extensionless inline-metadata scripts" to fix reading of requirements files from streams ([#&#8203;16861](astral-sh/uv#16861))
- Validate URL wheel tags against `Requires-Python` and required environments ([#&#8203;16824](astral-sh/uv#16824))

##### Documentation

- Drop unpublished crates from the uv crates.io README ([#&#8203;16847](astral-sh/uv#16847))
- Fix the links to uv in crates.io member READMEs ([#&#8203;16848](astral-sh/uv#16848))

### [`v0.9.12`](https://github.com/astral-sh/uv/blob/HEAD/CHANGELOG.md#0912)

[Compare Source](astral-sh/uv@0.9.11...0.9.12)

Released on 2025-11-24.

##### Enhancements

- Allow `--with-requirements` to load extensionless inline-metadata scripts ([#&#8203;16744](astral-sh/uv#16744))
- Collect and upload PEP 740 attestations during `uv publish` ([#&#8203;16731](astral-sh/uv#16731))
- Prevent `uv export` from overwriting `pyproject.toml` ([#&#8203;16745](astral-sh/uv#16745))

##### Documentation

- Add a crates.io README for uv ([#&#8203;16809](astral-sh/uv#16809))
- Add documentation for intermediate Docker layers in a workspace ([#&#8203;16787](astral-sh/uv#16787))
- Enumerate workspace members in the uv crate README ([#&#8203;16811](astral-sh/uv#16811))
- Fix documentation links for crates ([#&#8203;16801](astral-sh/uv#16801))
- Generate a crates.io README for uv workspace members ([#&#8203;16812](astral-sh/uv#16812))
- Move the "Export" guide to the projects concept section ([#&#8203;16835](astral-sh/uv#16835))
- Update the cargo install recommendation to use crates ([#&#8203;16800](astral-sh/uv#16800))
- Use the word "internal" in crate descriptions ([#&#8203;16810](astral-sh/uv#16810))

</details>

---

### Configuration

📅 **Schedule**: 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 MR becomes conflicted, or you tick the rebase/retry checkbox.

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

---

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

---

This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0Mi4xOS43IiwidXBkYXRlZEluVmVyIjoiNDIuMjEuMyIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiUmVub3ZhdGUgQm90Il19-->
konstin added a commit to astral-sh/packse that referenced this pull request Nov 27, 2025
Test case for astral-sh/uv#16824 (comment). Introduces `required-environments` to packse.
konstin added a commit to astral-sh/packse that referenced this pull request Nov 27, 2025
Test case for astral-sh/uv#16824 (comment). Introduces `required-environments` to packse.
konstin added a commit to astral-sh/packse that referenced this pull request Nov 27, 2025
Test case for astral-sh/uv#16824 (comment). Introduces `required-environments` to packse, with a basic passing
`requires-python-subset` case.
konstin added a commit to astral-sh/packse that referenced this pull request Nov 27, 2025
Test case for astral-sh/uv#16824 (comment). Introduces `required-environments` to packse, with a basic passing
`requires-python-subset` case.
konstin added a commit to astral-sh/packse that referenced this pull request Nov 27, 2025
Test case for astral-sh/uv#16824 (comment). Introduces `required-environments` to packse, with a basic passing
`requires-python-subset` case.
konstin added a commit to astral-sh/packse that referenced this pull request Nov 27, 2025
Test case for astral-sh/uv#16824 (comment). Introduces `required-environments` to packse, with a basic passing
`requires-python-subset` case.
konstin added a commit that referenced this pull request Nov 27, 2025
konstin added a commit that referenced this pull request Nov 27, 2025
konstin added a commit to astral-sh/packse that referenced this pull request Nov 27, 2025
Test case for astral-sh/uv#16824 (comment). Introduces `required-environments` to packse, with a basic passing
`requires-python-subset` case.
konstin added a commit that referenced this pull request Nov 27, 2025
konstin added a commit to astral-sh/packse that referenced this pull request Nov 27, 2025
Add a test case for
astral-sh/uv#16824 (comment).
Introduces `required-environments` to packse, with a basic passing
`requires-python-subset` case.
konstin added a commit that referenced this pull request Nov 27, 2025
Add astral-sh/packse#293 for #16824 (comment)

Beware of mitsuhiko/insta#833 when working with packse for the time being (i.e., `cargo binstall cargo-insta@1.42.1 --force`)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

uv.lock doesn't include hashes for path-based wheels

2 participants