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

Upcoming breaking changes #74

Closed
uranusjr opened this issue Mar 7, 2021 · 0 comments · Fixed by #78
Closed

Upcoming breaking changes #74

uranusjr opened this issue Mar 7, 2021 · 0 comments · Fixed by #78

Comments

@uranusjr
Copy link
Member

uranusjr commented Mar 7, 2021

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:

  • resolution: resolutions.get(identifier).
  • candidates: candidates[identifier].candidates is an abstraction around the return value of find_matches(). It implements the equence protocol if you returned a list from find_matches(). Otherwise, it is an iterable container.
  • information: criteria[identifier].information.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant