1. PyPA
  2. Python Packaging Authority Projects
  3. distlib
  4. Issues
Issue #18 resolved

AggregatingLocator fails if one source provides ANY version of a dist, but ALL are incompatible with the requirement

C Anthony Risinger
created an issue


given a dep finder like:

finder = DependencyFinder(AggregatingLocator(
    DirectoryLocator('/abs/path/to/sdists', recursive=False),
    SimpleScrapingLocator('https://pypi.python.org/simple/', timeout=3.0),

...the finder will fail to resolve 'wheel (== 0.18.0)' via JSONLocator if DirectoryLocator returns appropriate -- but incompatible!!! -- results. in my case, 'wheel-0.17.0.tar.gz' was found by DirectoryLocator, and the dict returned from _get_project immediately (since merge=False)... however since this Locator does not fulfill the requirement, an exception is thrown.


i can see from the code/interface that _get_project cannot [currently] determine if a given Locator actually fulfills the requirement until after it returns... unfortunately this makes the AggregatingLocator much less useful (eg. return the first Locator that MEETS THE GIVEN REQUIREMENT, not just matches the key [any requirement])


i propose changing _get_project to a generator that returns the solutuion set from each locator, one at a time, and allow the locate() method to exhaust the sets... note: i did not test this (or look too closely at ramifications -- just an initial guess).

other options may be to implement locate() in AggregatingLocator, add a "greedy" arg (or similar) to Locator.locate... or a new kind of Locator altogether?

Comments (3)

  1. C Anthony Risinger reporter

    BTW, docs said to use this for bugs, please LMK if otherwise... intergrating distlib has been for the most part a great experience with pretty solid docs and a well-thought-out API, bravo! and thanks!

  2. Log in to comment