You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using workspaces, we uses the combined requires-python of all packages. Say you have foo that requires python 3.8 and bar that requires python 3.12, we require that all dependencies are compatible with python 3.8. This limits the usefulness of workspaces (#5578, #5398).
An alternative would the following: We create separate resolution for workspace members with separate python requirements: When we encounter foo and bar, we fork into a resolution for 3.8 through 3.11 and one for at least 3.12. In the >=3.8,<3.12 one, our root requirements are only foo, while for >=3.12, we start with foo and bar. When running uv sync -p 3.8 we then only install foo and its deps, while with uv sync -p 3.12, we install foo and bar and their deps. uv sync -p 3.8 --package bar is forbidden (error: bar requires at least python >=3.12, but you have 3.8). Naturally, you can have a requirement for bar in foo, while a requirement bar; python_version >= "3.12" is allowed in foo; the inverse is always allowed.
## Summary
As-is, if you have a workspace with mixed `requires-python`
requirements, resolution will _never_ succeed, since we'll use the union
as the `requires-python` bound (i.e., take the lowest value), and fail
when we see the package that only supports some more narrow range.
This PR modifies the behavior to take the intersection (i.e., the
highest value), so if you have one package that supports Python 3.12 and
later, and another that supports Python 3.8 and later, we lock for
Python 3.12. If you try to sync or run with Python 3.8, we raise an
error, since the lockfile will be incompatible with that request.
Konsti has a write-up in #5594
that outlines what could be a longer-term strategy.
Closes#5578.
When using workspaces, we uses the combined requires-python of all packages. Say you have foo that requires python 3.8 and bar that requires python 3.12, we require that all dependencies are compatible with python 3.8. This limits the usefulness of workspaces (#5578, #5398).
An alternative would the following: We create separate resolution for workspace members with separate python requirements: When we encounter foo and bar, we fork into a resolution for 3.8 through 3.11 and one for at least 3.12. In the
>=3.8,<3.12
one, our root requirements are only foo, while for>=3.12
, we start with foo and bar. When runninguv sync -p 3.8
we then only install foo and its deps, while withuv sync -p 3.12
, we install foo and bar and their deps.uv sync -p 3.8 --package bar
is forbidden (error: bar requires at least python>=3.12
, but you have3.8
). Naturally, you can have a requirement forbar
infoo
, while a requirementbar; python_version >= "3.12"
is allowed in foo; the inverse is always allowed.Implementing this likely requires #5583.
The text was updated successfully, but these errors were encountered: