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

Move PackageFinder's --trusted-host logic to PipSession #6903

Merged
merged 4 commits into from
Aug 22, 2019

Conversation

cjerdonek
Copy link
Member

This PR moves PackageFinder's --trusted-host logic to PipSession.

Before this PR, the --trusted-host state and logic was spread across two classes: PipSession (via its self.mount() calls) and PackageFinder (from its trusted_hosts attribute). This meant that both classes had to know about the trusted hosts and be kept in sync with each other when updating the trusted hosts.

Moving PackageFinder's --trusted-host logic to PipSession lets all of this logic be kept in one place. It also makes PackageFinder simpler, because (1) PackageFinder no longer has to know about or have methods to manage the trusted hosts (aside from a single property that delegates to the underlying PipSession), and (2) we no longer need to pass the trusted_hosts value to PackageFinder as an argument when constructing the PackageFinder instance (we only need to pass the PipSession argument). So the argument list becomes smaller on the PackageFinder side.

Putting it wholly in download.py also makes sense from a subject matter perspective.

@cjerdonek cjerdonek added type: refactor Refactoring code skip news Does not need a NEWS file entry (eg: trivial changes) C: finder PackageFinder and index related code labels Aug 21, 2019
@pradyunsg
Copy link
Member

This one's good @cjerdonek! ^>^

@cjerdonek
Copy link
Member Author

Awesome, thanks!

@cjerdonek
Copy link
Member Author

Thanks for reviewing, @chrahunt. I updated the PR.

Copy link
Member

@chrahunt chrahunt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. 👍

@pradyunsg pradyunsg merged commit ce218c3 into pypa:master Aug 22, 2019
@cjerdonek cjerdonek deleted the move-trusted-hosts branch August 22, 2019 18:36
@lock lock bot added the auto-locked Outdated issues that have been locked by automation label Sep 21, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Sep 21, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
auto-locked Outdated issues that have been locked by automation C: finder PackageFinder and index related code skip news Does not need a NEWS file entry (eg: trivial changes) type: refactor Refactoring code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants