Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

add show command for pip (issue #33) #517

Closed
wants to merge 8 commits into
from

Conversation

Projects
None yet
7 participants
Contributor

bernardofire commented Apr 24, 2012

usage:

I'll use specloud as example

$ pip show specloud

Package: specloud
Version: 0.4.4
Requires:
nose
figleaf
pinocchio

if the package doesn't have dependencies (figleaf for example):

$ pip show figleaf
Package: figleaf
Version: 0.6.1

I hope everything is alright.

Contributor

pnasrat commented May 2, 2012

Thanks for taking the time for doing this, about to review.

@pnasrat pnasrat commented on the diff May 2, 2012

pip/commands/show.py
@@ -0,0 +1,32 @@
+import sys
+import pkg_resources
+from pip.basecommand import Command
+from pip.exceptions import ShowError
+
+
+class ShowCommand(Command):
+ name = 'show'
+ usage = '%proc PACKAGE_NAME'
+ summary = 'Show information about some package'
@pnasrat

pnasrat May 2, 2012

Contributor

Maybe 'Show detailed information about an installed package'

@pnasrat pnasrat commented on the diff May 2, 2012

tests/test_show.py
@@ -0,0 +1,49 @@
+import sys
+import re
+import textwrap
+from doctest import OutputChecker, ELLIPSIS
+from tests.test_pip import reset_env, run_pip, write_file, get_env, pyversion
+from tests.local_repos import local_checkout, local_repo
+
+
+distribute_re = re.compile('^distribute==[0-9.]+\n', re.MULTILINE)
+
+
+def _check_output(result, expected):
@pnasrat

pnasrat May 2, 2012

Contributor

I'd rather this be addressed before merge - we should be able to test in a less brittle way.

Contributor

pnasrat commented May 2, 2012

I'm also wondering about the command name, it probably makes sense to have a single command to query installed packages with options for display (freeze output would be a special case of this). @carljm @jezdez views?

Contributor

bernardofire commented May 2, 2012

@pnasrat if you want me to change something, or if you'd rather implement the changes yourself, just let me know. It's up to you. =]

Contributor

pnasrat commented May 2, 2012

Sure I'm just thinking out loud in the code review. I'll take another look and give you more feedback tomorrow.

trbs commented May 5, 2012

Hi Guys,

I forked bernardofire's patches at https://github.com/trbs/pip

Making the pip show command a little bit more like apt-cache show.
In that it now also looks at PyPi when a package is not installed locally and showing latest version information.

Hopefully I didn't go too much outside of the scope of issue #33 :)

Example:

$ pip show celery
Package:        celery
Summary:        Distributed Task Queue
Version:        2.4.6
Latest Version: 2.5.3
Author:         Ask Solem
Documentation:  http://celeryproject.org
Homepage:       http://celeryproject.org
License:        BSD

Requires:
    anyjson>=0.3.1
    kombu>=1.4.3,<3.0.0
    python-dateutil>=1.5.0,<2.0.0

It tries to get it's information from both the local resources and PyPi where PyPi takes precedence unless --no-index is specified.

Points of improvements:

  • Tests, quite brittle since most of the meta data can change. Like homepages, summary's, etc.
  • Handling both pkgresoures + PKG-INFO and PyPi, not as clean as could be in my current patches i guess. And it relies now for a large part on thirdparty 'pkginfo' package since I didn't want to include an additional PKG-INFO file parser.
  • Add more of the meta data ?
  • Add the options for mirrors, alternative index urls, etc ? (like in pip install)
Contributor

bernardofire commented May 6, 2012

Since @trbs added more information, what about verbose options for this command ?

trbs commented May 6, 2012

That might be sensible :) I just the fields that seem the most reasonable/useful to me.

I do kinda like this list... maybe documentation can go into verbose with other meta information about packages.
Think most others would be helpful to have in the default. As I think this gives the user a pretty decent overview
about the package.

There is also a 'describe' command ticket in github... This might have the same function as displaying the full meta data of a package in 'pip show -v'.

@pnasrat How shall we coordinate to get this merged ?

  • You commented earlier that the unit tests needs some love
  • We can add the -v flag
  • If the external dependency is completely unwanted (which i can understand) I could try and parse PKG-INFO another way.
  • I can recommit my patches in @bernardofire issue33 branch.

merwok commented May 7, 2012

FYI with distutils2 you have the metadata action: pysetup metadata projectname

@gvalkov gvalkov referenced this pull request May 15, 2012

Closed

Rework command handling #463

Contributor

pnasrat commented May 19, 2012

@trbs I'm travelling at the moment, I don't know if I'll have a chance to look at this before I get back - I may be able to do it one evening this week.

It would be great to have additional information recorded by code in #507 being displayed as well.

Contributor

pnasrat commented Jul 1, 2012

Needs rebasing to current develop.

Contributor

qwcode commented Sep 12, 2012

@carljm close? considering pull #664? also close #33 too?

Contributor

carljm commented Sep 13, 2012

Hmm, sorry for the duplicated work here, I'd forgotten about this pull request and merged something very similar in #664. I'm going to leave this open for a bit as a reminder that I'd like to add in the dependencies bit into the merged show command, which doesn't have that.

The additions from @trbs look interesting, but I don't think we should use the PyPI XML-RPC interface at all, which I think means we can't do that type of feature. The experience with the search command (which also uses XML-RPC) has been a real hassle - if you depend on PyPI XML-RPC you can't support mirrors, you can't support custom package indexes, you can't support find-links... In practice link-scraping and setup.py metadata are the (janky) interface that pip supports to know about packages, and it only confuses things to support that type of interface in install but then something quite different, that may know about an entirely different set of packages, in search and show.

Contributor

carljm commented Sep 13, 2012

(Oh, and thanks @qwcode for drawing my attention to this and helping herd tickets...)

Contributor

carljm commented Sep 21, 2012

Added dependencies to show command in 28aeb03

@carljm carljm closed this Sep 21, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment