-
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
Move fast-dep handling to RequirementPreparer #8685
Commits on Aug 2, 2020
-
Don't set _dist until it has been validated
Previously a call to `_fetch_metadata` could result in several possible outcomes: 1. `_dist` set, `_provided` not set, dist returned - for lazy wheels 2. `_dist` set, `_provided` not set, exception - for bad lazy wheels 3. `_dist` not set, `_provided` not set, exception - for non-lazy req exceptions 4. `_dist` set, `_provided` not set, exception - for bad non-lazy reqs 5. `_dist` set, `_provided` set, dist returned - for non-lazy reqs and probably more. Our intent is to use `_dist` being set as the indicator of "this requirement has been fully processed successfully" and discard `_prepared`, since we don't actually rely on any of the other states (they simply lead to a failure or in the future a retry).
Configuration menu - View commit details
-
Copy full SHA for d957cc9 - Browse repository at this point
Copy the full SHA d957cc9View commit details -
Remove redundant guard variable
Now that `_dist` is only set on success, we can use it to guard against repeated execution instead of `_prepared`. As a result there are now only two possible outcomes for calling `dist`: 1. `_dist` set and returned - lazy and non-lazy req 2. `_dist` not set and exception raised - bad lazy or bad non-lazy req
Configuration menu - View commit details
-
Copy full SHA for 7289625 - Browse repository at this point
Copy the full SHA 7289625View commit details -
Remove unnecessary check for _dist
Since `_prepare` now internally validates that `_dist` isn't set, we don't need to.
Configuration menu - View commit details
-
Copy full SHA for 7a5e043 - Browse repository at this point
Copy the full SHA 7a5e043View commit details -
Move non-lazy req fallback outside of
_fetch_metadata
No change in behavior, we just want to unify "requirements processing" and moving this function out is a prereq for moving `_fetch_metadata` in.
Configuration menu - View commit details
-
Copy full SHA for 4d94ae4 - Browse repository at this point
Copy the full SHA 4d94ae4View commit details -
Move _fetch_metadata into _prepare
Since `_prepare` is called in two places, we preserve the `if self._dist is not None` protection above the new call to `_fetch_metadata`. The second `if` in `_prepare` handles the early return required when processing a lazy wheel.
Configuration menu - View commit details
-
Copy full SHA for 8c3c0ad - Browse repository at this point
Copy the full SHA 8c3c0adView commit details -
Move common processing out of _fetch_metadata
Returning a `Distribution` makes `_fetch_metadata` look more like `_prepare_distribution`, in preparation for moving it there next.
Configuration menu - View commit details
-
Copy full SHA for a72d04f - Browse repository at this point
Copy the full SHA a72d04fView commit details -
Remove extra metadata consistency check
Instead of an early return, we fall through to the existing check at the end of this function. This aligns our treatment of `_fetch_metadata` and `_prepare_distribution`.
Configuration menu - View commit details
-
Copy full SHA for ec5b6d7 - Browse repository at this point
Copy the full SHA ec5b6d7View commit details -
Move call to _fetch_metadata next to call to RequirementPreparer
Since wheels can't be editable, we can move this into LinkCandidate, closer to `RequirementPreparer.prepare_linked_requirement` into which we want to integrate `_fetch_metadata`.
Configuration menu - View commit details
-
Copy full SHA for 45ab317 - Browse repository at this point
Copy the full SHA 45ab317View commit details -
Move lazy_wheel warning out of Resolver
This warning just needs to be traced in one place for all commands, there's no need for the resolver to know about it. Moving the warning out of the Resolver will make it easier to change how we provide the option.
Configuration menu - View commit details
-
Copy full SHA for e49dcfd - Browse repository at this point
Copy the full SHA e49dcfdView commit details -
Propagate lazy_wheel option through RequirementPreparer
Reduces dependence on Candidate (and Resolver (and Factory)).
Configuration menu - View commit details
-
Copy full SHA for f0d4df1 - Browse repository at this point
Copy the full SHA f0d4df1View commit details -
Pass InstallRequirement to _fetch_metadata
Reduces dependence on Candidate.
Configuration menu - View commit details
-
Copy full SHA for f460307 - Browse repository at this point
Copy the full SHA f460307View commit details -
Use link from InstallRequirement
Since when we generate the InstallRequirement we set the link, these must be the same. Reduces dependence on Candidate.
Configuration menu - View commit details
-
Copy full SHA for defbf82 - Browse repository at this point
Copy the full SHA defbf82View commit details -
Extract name and version from Wheel link
We happen to know that this is the same treatment that gave us `_name` and `_version` for Wheels in the first place (in `LinkEvaluator`). It's not ideal, however the metadata consistency check that occurs in `Candidate` after creation of a `Distribution` guards us against any deviation in the name and version during our processing. Reduces dependence on Candidate.
Configuration menu - View commit details
-
Copy full SHA for 9e46391 - Browse repository at this point
Copy the full SHA 9e46391View commit details -
Promote Wheel-related assertions to LinkCandidate constructor
These are things we know will be true because of the existing wheel processing. In the future we may delegate the extraction of these to the LinkCandidate itself so it doesn't have to be an assertion.
Configuration menu - View commit details
-
Copy full SHA for 4e1bff7 - Browse repository at this point
Copy the full SHA 4e1bff7View commit details -
Move _fetch_metadata to RequirementPreparer
The fact that all of this functionality can be put in terms of the `RequirementPreparer` indicates that, at least at this point, this is the cleanest place to put this functionality.
Configuration menu - View commit details
-
Copy full SHA for 6c4d4f3 - Browse repository at this point
Copy the full SHA 6c4d4f3View commit details -
Reduces dependence on `InstallRequirement` being passed to `_fetch_metadata`.
Configuration menu - View commit details
-
Copy full SHA for 21db4f3 - Browse repository at this point
Copy the full SHA 21db4f3View commit details -
Pass link to _fetch_metadata instead of req
Removes dependence on `InstallRequirement`.
Configuration menu - View commit details
-
Copy full SHA for c7ade15 - Browse repository at this point
Copy the full SHA c7ade15View commit details -
Prepare lazy wheels more so they are downloaded
This keeps all knowledge about preparation and types of requirements in `RequirementPreparer`, so there's one place to look when we're ready to start breaking it apart later.
Configuration menu - View commit details
-
Copy full SHA for 8b838eb - Browse repository at this point
Copy the full SHA 8b838ebView commit details