-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Support for multiple versions of the same package in different optional dependencies #8024
Labels
duplicate
This issue or pull request already exists
Comments
Duplicate of #6981 cc @BurntSushi |
BurntSushi
added a commit
that referenced
this issue
Nov 13, 2024
This PR adds support for conflicting extras. For example, consider some optional dependencies like this: ```toml [project.optional-dependencies] project1 = ["numpy==1.26.3"] project2 = ["numpy==1.26.4"] ``` These dependency specifications are not compatible with one another. And if you ask uv to lock these, you'll get an unresolvable error. With this PR, you can now add this to your `pyproject.toml` to get around this: ```toml [tool.uv] conflicting-groups = [ [ { package = "project", extra = "project1" }, { package = "project", extra = "project2" }, ], ] ``` This will make the universal resolver create additional forks internally that keep the dependencies from the `project1` and `project2` extras separate. And we make all of this work by reporting an error at **install** time if one tries to install with two or more extras that have been declared as conflicting. (If we didn't do this, it would be possible to try and install two different versions of the same package into the same environment.) This PR does *not* add support for conflicting **groups**, but it is intended to add support in a follow-up PR. Closes #6981 Fixes #8024 Ref #6729, Ref #6830 This should also hopefully unblock dagster-io/dagster#23814, but in my testing, I did run into other problems (specifically, with `pywin`). But it does resolve the problem with incompatible dependencies in two different extras once you declare `test-airflow-1` and `test-airflow-2` as conflicting for `dagster-airflow`. NOTE: This PR doesn't make `conflicting-groups` public yet. And in a follow-up PR, I plan to switch the name to `conflicts` instead of `conflicting-groups`, since it will be able to accept conflicting extras _and_ conflicting groups.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Summary
I'm working on a project that requires different versions of the same package for two separate environments. For example, I need
numpy==2.1.2
for one environment andnumpy==2.0.0
for another. However, UV does not seem to support this scenario, as it results in dependency resolution conflicts.Expected behavior
Is there a way to specify different versions of the same package in separate optional dependencies without causing conflicts?
Example
Here is a simplified example of my
pyproject.toml
file:Issue
When I run uv sync with this configuration, I get
No solution found when resolving dependencies for split (python_full_version == '3.11.*')
error.My current uv version is 0.4.19 installed from brew.
Why this would be useful
In cases like our repository, where different subprojects require different versions of the same package, not having this feature forces us to create a separate project for each subproject within the same repository. This approach is less convenient compared to having distinct optional dependencies that are exclusive to each other.
The text was updated successfully, but these errors were encountered: