Skip to content
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

Merged
merged 18 commits into from
Aug 4, 2020

Commits on Aug 2, 2020

  1. 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).
    chrahunt committed Aug 2, 2020
    Configuration menu
    Copy the full SHA
    d957cc9 View commit details
    Browse the repository at this point in the history
  2. 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
    chrahunt committed Aug 2, 2020
    Configuration menu
    Copy the full SHA
    7289625 View commit details
    Browse the repository at this point in the history
  3. Remove unnecessary check for _dist

    Since `_prepare` now internally validates that `_dist` isn't set, we
    don't need to.
    chrahunt committed Aug 2, 2020
    Configuration menu
    Copy the full SHA
    7a5e043 View commit details
    Browse the repository at this point in the history
  4. 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.
    chrahunt committed Aug 2, 2020
    Configuration menu
    Copy the full SHA
    4d94ae4 View commit details
    Browse the repository at this point in the history
  5. 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.
    chrahunt committed Aug 2, 2020
    Configuration menu
    Copy the full SHA
    8c3c0ad View commit details
    Browse the repository at this point in the history
  6. 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.
    chrahunt committed Aug 2, 2020
    Configuration menu
    Copy the full SHA
    a72d04f View commit details
    Browse the repository at this point in the history
  7. 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`.
    chrahunt committed Aug 2, 2020
    Configuration menu
    Copy the full SHA
    ec5b6d7 View commit details
    Browse the repository at this point in the history
  8. 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`.
    chrahunt committed Aug 2, 2020
    Configuration menu
    Copy the full SHA
    45ab317 View commit details
    Browse the repository at this point in the history
  9. 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.
    chrahunt committed Aug 2, 2020
    Configuration menu
    Copy the full SHA
    e49dcfd View commit details
    Browse the repository at this point in the history
  10. Propagate lazy_wheel option through RequirementPreparer

    Reduces dependence on Candidate (and Resolver (and Factory)).
    chrahunt committed Aug 2, 2020
    Configuration menu
    Copy the full SHA
    f0d4df1 View commit details
    Browse the repository at this point in the history
  11. Pass InstallRequirement to _fetch_metadata

    Reduces dependence on Candidate.
    chrahunt committed Aug 2, 2020
    Configuration menu
    Copy the full SHA
    f460307 View commit details
    Browse the repository at this point in the history
  12. Use link from InstallRequirement

    Since when we generate the InstallRequirement we set the link, these
    must be the same.
    
    Reduces dependence on Candidate.
    chrahunt committed Aug 2, 2020
    Configuration menu
    Copy the full SHA
    defbf82 View commit details
    Browse the repository at this point in the history
  13. 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.
    chrahunt committed Aug 2, 2020
    Configuration menu
    Copy the full SHA
    9e46391 View commit details
    Browse the repository at this point in the history
  14. 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.
    chrahunt committed Aug 2, 2020
    Configuration menu
    Copy the full SHA
    4e1bff7 View commit details
    Browse the repository at this point in the history
  15. 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.
    chrahunt committed Aug 2, 2020
    Configuration menu
    Copy the full SHA
    6c4d4f3 View commit details
    Browse the repository at this point in the history
  16. Log in one common location

    Reduces dependence on `InstallRequirement` being passed to
    `_fetch_metadata`.
    chrahunt committed Aug 2, 2020
    Configuration menu
    Copy the full SHA
    21db4f3 View commit details
    Browse the repository at this point in the history
  17. Pass link to _fetch_metadata instead of req

    Removes dependence on `InstallRequirement`.
    chrahunt committed Aug 2, 2020
    Configuration menu
    Copy the full SHA
    c7ade15 View commit details
    Browse the repository at this point in the history
  18. 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.
    chrahunt committed Aug 2, 2020
    Configuration menu
    Copy the full SHA
    8b838eb View commit details
    Browse the repository at this point in the history