sarugaku / resolvelib

Resolve abstract dependencies into concrete ones
ISC License
142 stars 31 forks source link

Upcoming breaking changes #74

Closed uranusjr closed 3 years ago

uranusjr commented 3 years ago

I’m going to work toward 0.6.0, which is going to contain several breaking changes. This post serves both as a heads-up and summary to myself so I don’t forget something or have to add new things at the last minute.

Keyword arguments

All Provider and Reporter methods will be called with keyword arguments from now on. This means you can start adding **kwargs for future compatibility now.

find_matches argument changes

def find_matches(
    identifier: Identifier,
    requirements: Mapping[Identifier, List[Requirement]],
    incompatibilities: Mapping[Identifier, List[Candidate]],
) -> Matches: ...

The current requirements: List[Requirement] can be replaced by requirements[identifier]. The new incompatibilities argument provides incompatible candidates already known to the resolver. The provider must exclude them from the result.

get_preference argument changes

def get_preference(
    identifier: Identifier,
    resolutions: Mapping[Identifier, Candidate],
    candidates: Mapping[Identifier, Collection[Candidate]],
    information: Mapping[Identifier, Sequence[Information]],
) -> Preference: ...

Identifier is the return type of identify. Criterion is the same as in Result.

Old get_preference() arguments can be replaced by: