Comments (4)
is it necessary that the same candidate is returned in both calls, or is it enough that "equivalent" candidates are returned?
The resolver does not compare candidates with each other, exactly because of the reason you raised: it does not (cannot) assume this is a sensical thing to do. So yes, it will result in duplicated work if equivalent (whatever this means) candidates are returned by find_matches()
.
I would incline to treat this as an optimisation problem; we be conservative right now and return some equivalent candidates if weβre not sure, and slowly figure out how to eliminate them. I also feel this would not be a very big problem in practice for pip, since PackageFinder
already eliminates a lot of the duplicates. The only source of duplication would be direct URL and local source dir, either is used very much currently AFAICT since the current legacy resolver does not handle them very well.
from resolvelib.
And, one (nice?) thing about the separation of concerns in this API design, is that the optimization can/should happen on the Provider side, which is best positioned to correctly identify and cache "equivalent" candidates.
from resolvelib.
Cool, I'm happy with that. But just to be clear, if I follow the logic in the code:
- The first requirement with a given
identify()
value (the reqirement's "name") hasfind_matches()
called for it. - Subsequent requirements are merged - we never even call
find_matches()
(maybe except if we backtrack, I never checked that code yet).
So the question of "multiple copies of the same candidate" never even crops up in the resolution code.
IMO, at some point this should be added to the docs, as a clarification. But for now I'm happy to simply have this issue as a reference.
It's easy to lose track of this when writing Requirement
and Candidate
objects that have the provider methods delegated to them (like the pip prototype does at the moment). I'm wondering whether it was a mistake to do that. Cue rewrite number 20 of the pip integration code π
from resolvelib.
I'm honestly a little concerned with the delegating that we're doing in our implementation, since it feels like more refactoring work later to cleanup responsibilities. But, yea, it's not a major concern but more of a back of the head thought atm.
from resolvelib.
Related Issues (20)
- Let's move this to the `pypa` organisation? HOT 4
- 0.8.1: pytest warnings HOT 3
- Typing inconsistency: `AbstractProvider.get_preferences` HOT 1
- Implement lazy consumption of the candidates iterable returned by find_matches() HOT 1
- Sdist releases on pypi.org do not contain files required for tests HOT 2
- Add documentation HOT 5
- Test Failures With Packaging 22.0/23.0 HOT 1
- Drop support for Python prior to 3.7 HOT 3
- Default branch has been renamed to `main` and branch protections enabled
- Resolvelib 0.9.0 passes identifiers to Provider's `get_preference` method without accompanying PreferenceInformation HOT 5
- Please make a new release
- Required Python versions not specified in pip-readable way HOT 1
- 0.9.0: pytest is failing in 6 units HOT 3
- sdist is missing conftest.py HOT 1
- Option to only provide causes of conflict when calling get_preference HOT 2
- An example of resolution failure while it does have a valid resolution. HOT 21
- Awkward wording in docstring for `find_matches()` HOT 5
- Implement Causes Narrowing HOT 1
- Toward 1.0 HOT 12
- ResolveLib 2.0 and unsupported Pythons HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from resolvelib.