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

Let downstream library to define causes object #99

Closed
wants to merge 5 commits into from

Conversation

notatallshaw
Copy link
Collaborator

@notatallshaw notatallshaw commented Dec 18, 2021

Addresses comments made in #93 (comment)

Provider now has a causes method that allows it to define what the causes object looks like.

The returned object must implement the following:

  • Have truthiness
  • Be copyiable using copy.copy

For example if would be possible to implement the method like so to preserve the existing behavior (would work on Python 2.7 to 3.10):

def causes(self, causes):
    return [i for c in causes for i in c.information]

There is an accompanying pip PR (pypa/pip#10732) that leverages this new interface to resolve the performance issues described in pypa/pip#10621

Need some hints / help defining a better type than "Any" for "causes" if that matters.

@notatallshaw
Copy link
Collaborator Author

notatallshaw commented Dec 19, 2021

There are some architectural differences between the way I've implemented this and how Requirement and Candidate work.

@uranusjr if you get a chance some time let me know if this is what you were thinking or if I missed the shot and need to make some correction.

@notatallshaw
Copy link
Collaborator Author

Upon some further thinking this approach is type unsafe, I need to study how other objects are implemented a bit better first.

@hswong3i hswong3i mentioned this pull request Dec 28, 2021
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 this pull request may close these issues.

1 participant