mirror of
https://github.com/astral-sh/uv.git
synced 2025-08-04 10:58:28 +00:00
![]() ## Summary This PR ensures that when the user passes in `--python-version`, we adjust the _markers_ to match the target version, thus forcing us to select compatible wheels for the `--python-version`, rather than the installed version. ## Context Let's call Python 3.10 the "installed" environment and Python 3.12 the "target" environment. For each version, we have _both_ a Python version (to match against `Requires-Python`) and a set of tags (to match against wheels). The rules for resolution are as follows... - For each package, for each version, we try to find the "best candidate" for resolution and installation. - We first look for a wheel that's compatible with the _target_ environment. This requires testing against both the `Requires-Python` and the markers. (We won't have to build or run this code, so the _installed_ version is irrelevant.) **(This PR corrects _this_ bullet -- previously, we validated against the _installed_ markers, rather than the target markers.)** - If we can't find a compatible wheel, we accept any _incompatible_ wheel as long as there's a source distribution. The source distribution _must_ be compatible with the target environment. (We won't have to build or run this code, so the _installed_ version is irrelevant.) - If there are no wheels, then the source distribution must be compatible with _both_ the installed and target environments, since we need to build it. This is all true for the top-level resolution. When we perform a sub-resolution (when resolving the build dependencies of a source distribution), we should _only_ use the installed environment, and ignore the target environment, since we assume that the dependencies will be the same in both environments once built -- so our goal is "just" to build the distribution, without concern for which build dependencies it uses. Closes https://github.com/astral-sh/puffin/issues/883. |
||
---|---|---|
.. | ||
src | ||
Cargo.toml |