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

Add a pip check command. #3750

Merged
merged 1 commit into from
Jun 25, 2016
Merged

Conversation

BrownTruck
Copy link
Contributor

I've taken the work from @Wilfred in #1001 and updated it to work with the latest code on develop and refactored a bit.

This command ensures that all packages installed have all the requirements they need, and that requirements have compatible versions. This is useful because pip can install incompatible dependencies, or a user may have manually (un)installed a package.

It looks like this if everything is okay:

[marca@marca-mac2 pip]$ pip check
[marca@marca-mac2 pip]$ echo $?
0

but if a package is missing:

[marca@marca-mac2 pip]$ pip check
pyramid 1.5.2 requires WebOb, which is not installed.
[marca@marca-mac2 pip]$ echo $?
1

or is the wrong version:

[marca@marca-mac2 pip]$ pip check
pyramid 1.5.2 has requirement WebOb>=1.3.1, but you have WebOb 0.8.
[marca@marca-mac2 pip]$ echo $?
1


This was automatically migrated from #2492 to reparent it to the master branch. Please see original pull request for any previous discussion.

Original Submitter: @msabramo

This command ensures that all packages installed have all the
requirements they need, and that requirements have compatible
versions. This is useful because pip can install incompatible
dependencies[1], or a user may have manually (un)installed a
package.

[1] pypa#775
@msabramo
Copy link
Contributor

msabramo commented Jun 1, 2016

Maintainers: does this need anything?

@pradyunsg
Copy link
Member

Maintainers: does this need anything?

Pinging @xavfernandez @pfmoore @dstufft @njsmith


"""
result = script.pip('check')
assert result.stdout == ""
Copy link
Member

Choose a reason for hiding this comment

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

As a general UI principle, it's probably better if it explicitly says something like "No problems found 👍" instead of just returning with an empty stdout.

@njsmith
Copy link
Member

njsmith commented Jun 25, 2016

Skimmed the code and made one minor comment. Seems like a good idea to me and the tests make sense, but I don't know pip's internals well enough to say definitively, and don't have permissions to merge anyway :-)

@rbtcollins
Copy link

See also #2687 - which is about the underlying cause of this - is it perhaps worth a link to the bug in docs?

@pfmoore
Copy link
Member

pfmoore commented Jun 25, 2016

Looks OK to me. I'll leave it a few hours in case any of the other maintainers have any issues, otherwise I'll merge (ping me if I forget :-))

@pfmoore pfmoore merged commit d7444b7 into pypa:master Jun 25, 2016
@pradyunsg
Copy link
Member

pradyunsg commented Jun 26, 2016

Just had a thought, adding a flag to pip check to see if there's packages that can be upgraded without breaking the environment's version requirements...

I don't know about the feasibility or the complexity of this but seems like a nice thing to have.

present_dist = installed_dists_by_name.get(requirement.project_name)

if present_dist and present_dist not in requirement:
incompatible_requirements.add((requirement, present_dist))
Copy link
Contributor

Choose a reason for hiding this comment

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

incompatible_requirements is never used?

Copy link
Member

Choose a reason for hiding this comment

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

Apparently yes, this could be removed.

Copy link
Contributor

Choose a reason for hiding this comment

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

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

Successfully merging this pull request may close these issues.

9 participants