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

Restrict install time dependency warnings to directly-dependant packages #5457

Merged

Conversation

pradyunsg
Copy link
Member

This PR changes the install-time-warnings to check the consistency of just the packages to-be-installed in that run and packages that directly depend on the ones that are to-be-installed; instead of the current behavior of checking the entire package set.

This should resolve #5196.

/cc @di @cjerdonek

@pradyunsg pradyunsg added type: enhancement Improvements to functionality C: check Checking dependency graph for consistency labels May 30, 2018
@pradyunsg pradyunsg self-assigned this May 30, 2018
@pradyunsg pradyunsg added T: bugfix and removed type: enhancement Improvements to functionality labels May 30, 2018


def check_package_set(package_set):
# type: (PackageSet) -> CheckResult
def check_package_set(package_set, whitelist=None):
Copy link
Member

Choose a reason for hiding this comment

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

Since you're only using whitelist to check membership, it might make more sense for this to be a set.

@@ -52,6 +56,10 @@ def check_package_set(package_set):
missing_deps = set() # type: Set[Missing]
conflicting_deps = set() # type: Set[Conflicting]

# Ignore dependency when it's not in the whitelist.
if whitelist is not None and package_name not in whitelist:
Copy link
Member

Choose a reason for hiding this comment

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

For reasons of elegance, it would be nice if you didn't have to repeat the None check in each iteration of the loop. An alternative to passing a list or set would be to pass a should_ignore() function. The first couple lines of your function could then be:

if should_ignore is None:
    should_ignore = lambda package_name: False

meaning your conditional would be:

if should_ignore(package_name):
    continue

Copy link
Member

@di di left a comment

Choose a reason for hiding this comment

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

LGTM!

@cjerdonek
Copy link
Member

cjerdonek commented May 31, 2018 via email

@pradyunsg pradyunsg added this to the 18.0 milestone Jun 5, 2018
@pradyunsg
Copy link
Member Author

@pypa/pip-committers I'm happy to merge this if no one else has any issues with this.

@pradyunsg pradyunsg added the needs rebase or merge PR has conflicts with current master label Jun 13, 2018
@pradyunsg pradyunsg force-pushed the check/only-check-requirements-modified branch from 70c2acf to a25e941 Compare June 13, 2018 10:36
@pypa-bot pypa-bot removed the needs rebase or merge PR has conflicts with current master label Jun 13, 2018
@pradyunsg pradyunsg force-pushed the check/only-check-requirements-modified branch from 9c5b254 to 5842476 Compare June 13, 2018 14:55
@pradyunsg pradyunsg force-pushed the check/only-check-requirements-modified branch from 5842476 to 161e8bd Compare June 15, 2018 06:00
@pradyunsg
Copy link
Member Author

Merging since I am happy with this PR. :)

@pradyunsg pradyunsg merged commit ca031c1 into pypa:master Jun 17, 2018
@pradyunsg pradyunsg deleted the check/only-check-requirements-modified branch June 17, 2018 06:45
@lock
Copy link

lock bot commented Jun 2, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot added the auto-locked Outdated issues that have been locked by automation label Jun 2, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Jun 2, 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: check Checking dependency graph for consistency
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[10.0.0beta] Installation emits extra warnings for unrelated packages
4 participants