The multiple-pip invocation tests I wrote appear to be currently valid, but I honestly didn't remember.
Anyway, time to pin down my concerns with AlreadyInstalledCandidates.
There are five leaf classes of Candidate.
- LinkCandidate and EditableCandidate are basically the same for my purposes, and I think I know how I'm going to work with them.
- If I understand their use cases correctly, the correct course of action when any code I touch encounters an ExtrasCandidate or a RequiresPythonCandidate is to do whatever it does currently.
- An AlreadyInstalledCandidate can come from a few sources, and in any case, I need to be able to tell where it was installed from, in a way that's compatible with the Link field I'm adding to Constraints.
(It has to be a Link, because it's required to generate the corresponding candidate.)
So, what I need to move forward on this is a generic way to determine where a Candidate is/will be installed from, keeping in mind that it's not possible to generate a sensible answer for some candidates.
Now, one factor common to the Candidates that I care about is the Distribution. And it's possible for a Distribution to allow for the generation of a DirectUrl object, but this appears to only be possible, from some quick inspection of one of my projects, if the local candidate was in fact installed from a URL. Let's see if I can track down the issue I'm worried about complicating.
Thinking about this, it's probably sensible to treat "a resolved package that was installed from an index" differently from "a package that was installed via direct link into an index, for some reason".
So, I think I know what needs to be done. I'm not going to rush into it. I want to confirm my ideas here with the maintainers, and I'll be taking things easy for unrelated reasons this weekend, so it could be a little while before I actually touch the code.
Actually, I'll wait to confirm, because something about the flow here still confuses me. I'm going to have to study this, and perhaps experiment...
Hm, looking at this, I wouldn't be surprised if it turns out I was wrong about ExtrasCandidate, since it certainly exposes enough information currently to get checked by a constraint. This is so confusing, but I guess I've given myself plenty of time to figure it out.