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

filter dependencies by tracking markers on resolver forks #4339

Merged
merged 7 commits into from
Jun 17, 2024

Commits on Jun 17, 2024

  1. uv-resolver: document some of our intermediate data structures

    There are some key invariants that I had to re-learn by reading the
    code. This hopefully makes those invariants easier to discover by future
    me (and others).
    BurntSushi committed Jun 17, 2024
    Configuration menu
    Copy the full SHA
    e51d442 View commit details
    Browse the repository at this point in the history
  2. uv-resolver: filter dependencies that can't exist in a fork

    This commit adds marker expressions to our `Fork` type, which are in
    turn passed down into `PubGrubDependencies::from_requirements` to filter
    our any dependencies with markers that are disjoint from the fork's
    marker expression.
    
    This is necessary to avoid visiting packages in the dependency graph
    that can never actually be installed. This is because when a fork is
    created in the resolver, it always happens when there are two sibling
    dependency specifications on a package with the same name, but with
    non-overlapping marker expressions. Each fork corresponds to each
    such conflicting dependency specification, and each fork assumes the
    the corresponding marker expression as a pre-condition for any future
    dependencies considered by it. That is, since the fork represents an
    installation path that can only be taken when the corresponding
    dependency specification (and its marker expression) is actually used,
    it also therefore follows that the marker expression is true. Therefore,
    any dependency visited in that fork with a marker expression that cannot
    possibly be true when the markers of the fork are true can and ought to
    be completely ignored.
    BurntSushi committed Jun 17, 2024
    Configuration menu
    Copy the full SHA
    9f874c7 View commit details
    Browse the repository at this point in the history
  3. uv-resolver: fix bug in marker disjointness checking

    I found this while testing the tracking of marker expressions across
    resolver forks. Namely, given
    
        sys_platform == 'darwin' and implementation_name == 'pypy'
    
    And:
    
        sys_platform == 'bar' or implementation_name == 'foo'
    
    These should be disjoint, but the disjointness checker was reporting
    them as overlapping. I fixed this by giving handling of disjunctions
    higher precedence than conjunctions, although I am not 100% confident
    that this is correct for all cases.
    BurntSushi committed Jun 17, 2024
    Configuration menu
    Copy the full SHA
    bd983d7 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    bb50193 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    219c59d View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    dd629b1 View commit details
    Browse the repository at this point in the history
  7. uv/tests: add more fork marker tests

    These were prompted by @konstin's question here:
    #4339 (comment)
    BurntSushi committed Jun 17, 2024
    Configuration menu
    Copy the full SHA
    f43c2b2 View commit details
    Browse the repository at this point in the history