-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Returning a RequirementSet from Resolver.resolve #7638
Comments
This came up in #7571 (comment) |
Working notesMostly a brain dump of my investigations, so it's recorded somewhere public. I've just found a few other conversations that I need to follow up on, though, which may put all of the following in a different light. Review this against #7571 (comment), #6607 (comment) (and followup) AnalysisLooking at Internal use only Read-only from clients Modified by clients Other Methods ConclusionTwo things are tightly coupled here - So, two initial refactorings:
That leaves |
Note regarding #6607 comment: pip._internal.operations ended up being where we put the "cleaner abstractions" (they're basically the corresponding functions). I'm not against cleaning up add_requirement, it's just that it's extremely mixed in with the current resolution logic, so it might be a bit tricky to do that. I'm not sure how you're thinking of moving successfully_downloaded to requirements - are you thinking of iterating through a requirement set and filtering "this was downloaded" from that? |
I officially hate the GitHub mobile UI. |
That's what I was considering. I'm not sure how much improvement that would be, though. But having said that, I'm not actually sure it's important to do that refactoring at all. I'm still trying to understand how "make I guess I'm still trying to understand why doing this is a good thing.
You trendy youngsters doing open source on mobile :-) |
The refactoring helps because as I see it we have two options for implementing the new resolver while preserving the old one:
For the sake of understanding why the refactoring would be good let's assume we don't want to go with 1, so we want to go with 2. Then we can say a few things:
In that context "make |
At this point since all downloads are attached as paths to the |
Got it, thanks. So the key here is that we don't want the On the other hand it does mean that simplistically moving state to the |
My thinking is that "Before" deals strictly with something that represents a parsed requirement, and "After" deals with the Project objects. Like:
If you haven't already, check out the refactoring that was done over the past few months in |
It sounds bad when you say it like that. :) At the end we want the resulting objects to represent a thing that we can install or save. I would not rely on much more intimation than what is already exposed in It's not critical for this discussion, but a few notes we'll need for later:
|
Can you elaborate on this? I can see that we may need to look at how we tell the resolver that the user has specified Maybe the resolver would know it's already installed and be able to save us rechecking, but (a) I'd rather have less coupling and an extra check, and (b) I don't actually think the resolver would know that (or rather, it wouldn't have any better ability to deduce it than we would, and it has no need to know for its own purposes). One proviso here - depending on the upgrade strategy, part of the information the resolver will use to prioritise which version to coose will be "what is currently installed". But again, that's data we provide to the resolver, not data the resolver can return to us. Have I misunderstood what you're meaning by this comment? |
It wouldn't need to, you're right. As long as we enrich the resolver result with information indicating that some of the things already installed will need to be force-reinstalled then I think that's good enough. The resolver doesn't need to know about a "force install" option. Above I was imagining it from the perspective of a function that would take a "resolver result" (and an install scheme) and do the required installations with no other input.
In my view the resolver will return Projects (or some wrapper around them), or objects that we use as an index into a lookup table of the Projects that have been used during the resolution process. The rest of your statements sound reasonable to me. |
I've unassigned myself from this because I'm struggling to understand what it actually means. I get the broader goal of improving the control flow, and decoupling "before the resolve" from "after the resolve", but I'm not clear how this specific change would work in that context. So rather than block someone else from looking at it, I've unassigned myself. |
Description
Currently, pip's
Resolver.resolve
method is expected to mutate the RequirementSet provided to it; which results in a slightly difficult to follow control flow.Desired behavior
Known Challenges
pip's
install
,download
andwheel
commands, have arequirement_set.cleanup_files()
call in a try-finally, which means that the existing requirement set is clearly assumed to be the only one that exists. We'd likely want to construct a new set in the new resolver, so figuring out how we'd handle cleanups is the main thing to do here.The text was updated successfully, but these errors were encountered: