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

Prioritize forks #4926

Closed
konstin opened this issue Jul 9, 2024 · 1 comment · Fixed by #5643
Closed

Prioritize forks #4926

konstin opened this issue Jul 9, 2024 · 1 comment · Fixed by #5643
Assignees
Labels
enhancement New feature or improvement to existing functionality preview Experimental behavior

Comments

@konstin
Copy link
Member

konstin commented Jul 9, 2024

Say we have requirements a >= 1 ; sys_platform == 'linux' and a < 2 ; sys_platform == 'darwin'. There's two possible solutions: a==1 and a==2, and only a==1 for both forks.

Currently, it's order dependent:

dependencies = [
  'a<2; sys_platform == "darwin"',
  'a>=1; sys_platform == "linux"',
]

resolves 3 packages (a==1 and a==2),

dependencies = [
  'a>=1; sys_platform == "linux"',
  'a<2; sys_platform == "darwin"',
]

resolves 2 packages (only a==1).

When we resolve for latest versions (the default), we should process the fork a<2 first, since it will resolve to a lower version that the other fork accepts, while a >= 1 resolves to a preference (a==2) that a<2 rejects. When we resolve for lowest versions, it's the inverse. While either way is correct, only a==1 will give us a better (smaller) solution that is consistent between forks.

The same goes for requires-python: A fork with python_version >= "3.10" needs to run before python_version >= "3.12" , since the former allows less version than the latter; here it's independent of the version order.

We need to figure out the exact rules for prioritization considering highest vs. lowest versions, requires-python, lower vs. upper bounds and handling splitting over multiple packages.

@konstin konstin added the preview Experimental behavior label Jul 9, 2024
@charliermarsh
Copy link
Member

Agree with this. I actually think that (if done right) this would've prevented the problematic resolution in #4885. (I don't know if it would solve that problem in general though.)

@charliermarsh charliermarsh self-assigned this Jul 30, 2024
@charliermarsh charliermarsh added the enhancement New feature or improvement to existing functionality label Jul 30, 2024
charliermarsh added a commit that referenced this issue Jul 31, 2024
## Summary

First part of: #4926. We should
solve forks that _don't_ expand the world of supported versions (e.g.,
`python_version >= '3.11'` enables us to select new packages, since we
narrow the supported version range).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or improvement to existing functionality preview Experimental behavior
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants