-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Validate URL wheel tags against Requires-Python and required environments
#16824
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
1fce755 to
3542bfb
Compare
| ----- 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. |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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.
konstin
left a comment
There was a problem hiding this 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) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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`.
There was a problem hiding this comment.
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" }
Summary
Closes #16818.