Skip to content

Conversation

@charliermarsh
Copy link
Member

@charliermarsh charliermarsh commented Jul 1, 2024

Summary

This is similar to #4707, but in this case, we don't actually fork, because there are no divergent requirements. Consider:

uv ; python_version >= "3.8"

With -p 3.7. In this case, there's no version of uv that satisfies Python 3.7, but it's only required on Python 3.8 anyway.

The solution I settled on here is to... fork anyway? I'd like to get some input before setting it out, but it makes some sense to me: we want to solve with a different set of constraints than in the rest of the resolution.

Initially, I tried to just merge the fork markers with the requirement markers (i.e., the python_version >= "3.8" on the requirement itself) -- but that's insufficient. Imagine if instead we had a package foo that depended on uv, and foo ; python_version >= "3.8".

Closes #4668.

@charliermarsh charliermarsh added bug Something isn't working preview Experimental behavior labels Jul 1, 2024
@charliermarsh
Copy link
Member Author

I'm honestly not sure if this is sound.

@charliermarsh charliermarsh force-pushed the charlie/fork-python branch from 26d07d8 to 135fe79 Compare July 1, 2024 22:27
{ name = "anyio", version = "4.2.0", source = { registry = "https://pypi.org/simple" }, marker = "python_version < '3.12'" },
{ name = "anyio", version = "4.3.0", source = { registry = "https://pypi.org/simple" }, marker = "python_version >= '3.12'" },
{ name = "b1", marker = "python_version < '3.12'" },
{ name = "b2", marker = "python_version >= '3.12'" },
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok yeah this is just wrong.

@charliermarsh
Copy link
Member Author

Open to better ideas here. I think what I have in this PR is wrong actually.

@konstin
Copy link
Member

konstin commented Jul 2, 2024

I think the splitting can work, but we must only split when there the python marker is stricter than the current requires-python and be mindful if we're already splitting on the python version marker, which is happening root_package_splits_other_dependencies_too.

Base automatically changed from charlie/req-python to main July 2, 2024 12:23
@konstin
Copy link
Member

konstin commented Aug 20, 2024

Is this still applicable with #6143?

@zanieb zanieb removed the preview Experimental behavior label Aug 20, 2024
charliermarsh added a commit that referenced this pull request Oct 28, 2024
## Summary

This is a re-implementation of
#4712, though is now seemingly much
simpler. This issue keeps coming up, and users have a workaround with
`tool.uv.environments`, but it's really a bug in the resolver.

Closes #4668.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Python version limited requirement in universal locking

4 participants