Install prerelease of a project but not of its dependencies

I can see that it would get complicated. This isn’t really any different from the situation without prereleases though: what if the latest final release of A is incompatible with the latest final release of B? I don’t know how pip install A B actually handles that but in my experience it generally does what I want because pip tries to find the newest compatible versions somehow. In the context of pip’s current resolver I imagine that pip install --allow-prereleases-for=numpy would probably have the behaviour that I would want simply by allowing prereleases for numpy.

I emphasise that I want the newest prerelease because I am trying to convey the use case: testing latest prereleases of direct dependencies. In future pip might change its resolver or other tools might work in different ways right now. I don’t know if uv for example would do what I want simply by “allowing” prereleases (allowing is not the same as preferring).

I think I might have sometimes wanted that but it is not usually what I would want.

1 Like

So from this:

The main difference is “except”, neither pip nor uv currently have a concept of “resolve this requirement except it fails resolve this requirement”, it would (at least naively, there may be some clever algorithm here I’m not aware of) require multiple passes, adding a constraint of the latest prerelease on that package on the first pass, and then if it fails to resolve doing the resolution again without the constraint. This potentially doubles the work load when you have one prerelease specified, when you have two prereleases specified you might have to do four passes, when you have three prereleases specified you might have to do eight passes, etc.

And that’s assuming by ‘“most recent prerelease” objective to take priority’ you only mean take the very most recent prerelease or fallback to non-preleases, otherwise if you can take a combination of prereleases after the final release it’s exponential based on the number of versions available, not just the number of prerelease packages specified.

My discussion about the ambigious A and B was me thinking about how you apply all the different requirements you have, that being the “except” and “most recent” and “priority”, but that’s probably more semantics and I shouldn’t have mused on it. Just thinking about the “except” on it’s own is the difficult to implement efficiently part.

1 Like