-
Notifications
You must be signed in to change notification settings - Fork 12
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
Resolution fails if no versions can be found for a conditioned package #28
Comments
So currently, passa locks In this case, the children of I know modutil has no markers on it but just to use the same example |
I agree about modutil’s children should inherit the marker from modutil (Passa already does it), but what I’m describing is that when Passa finds versions on PyPI for modutil, it should consult its parent’s marker. Note that this is not about finding dependencies, but for finding versions of a requirement. modutil is not a very good example here to describe the problem, so I’ll invent something else. Django has the following Python version support matrix:
Django did not actually specify Requires-Python on PyPI for 1.11, but let’s pretend it did. Also, let’s pretend Django 2.0 is the latest release, for simplicity’s sake. Say I’m running Python 2.7, and have a package specifying this dependency:
What version of Django should it resolve to? Currently it won’t resolve at all, since the resolver checks whether the running interpreter satisfies a given version’s Requires-Python, and therefore won’t be able to find a version. The above mentioned #37 removes this restriction, and finds 2.0 correctly, and slap the marker on it. But this raises another problem. What if I have a dependency graph like this:
Previously this would correctly resolve Django to 1.11, but with #37 it would resolve into an uninstallable result (Django 2.0; python_version < '3'). The solution is that when the resolver finds versions for Django, it needs to compare the parent’s ( This is low priority for me, since you can simply provide additional hints in Pipfile to work around the problem. But it is still theoretically solvable, and I want to post it out so it is known and can be worked on if possible. |
Given this set of requirements it would be correct to not resolve anything. There is an explicit marker on django which essentially says 'don't install it at all unless you can install this version'. This is an issue with actually transferring and pinning the parent marker to the child requirement, especially in cases where the markers are potentially going to lead you down a path that is exclusive with another path (
So here's the real question, and since I know we talked about this in the past, I'll keep it short. What we really need is the ability to keep 2 copies of the same package in the lockfile, with different markers. In this example, we'd want to run the lock 2 times -- one with |
This fails if locked on 2.7:
I’m not completely sure what is the best approach. Should passa just always ignore requires-python when resolving? Should it still respect it, but choose the lowest version possible when it’s not possible to resolve?
Erroring out is not an option because e.g. pip-shims specifies
modutil; python_version >= '3.7'
, and locking would fail for everything under if a project depends on it. But pip-shims is intended to be used for those lower versions.The text was updated successfully, but these errors were encountered: