Skip to content
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

RFC: Handling diverging requires-python in workspaces with forking on the python version #5594

Open
konstin opened this issue Jul 30, 2024 · 0 comments
Labels
enhancement New feature or request needs-design Needs discussion, investigation, or design

Comments

@konstin
Copy link
Member

konstin commented Jul 30, 2024

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.

Implementing this likely requires #5583.

@konstin konstin added enhancement New feature or request needs-design Needs discussion, investigation, or design preview Experimental behavior labels Jul 30, 2024
charliermarsh added a commit that referenced this issue Jul 31, 2024
## 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.
@zanieb zanieb removed the preview Experimental behavior label Aug 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request needs-design Needs discussion, investigation, or design
Projects
None yet
Development

No branches or pull requests

2 participants