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

Print the latest version number in search results #1415

Merged
merged 5 commits into from Mar 4, 2016

Conversation

Projects
None yet
4 participants
@crodjer
Contributor

crodjer commented Jan 2, 2014

With the project name and summary, also mention the latest version of the
project which is present at pypi.
Useful in the scenario where developers are updating their project's
requirements.txt and need to compare the current upstream version against
their own installed version.

Review on Reviewable

@gvalkov

This comment has been minimized.

Show comment
Hide comment
@gvalkov

gvalkov Jan 3, 2014

Contributor

Nice idea, but the list is no longer aligned:

$ pip search optparse
oparse                    (0.9.2) - oparse is a command line framework based on optparse.
wxOptParse                (0.1.6) - wxOptParse: run the command line options from a dialog box.
optparse_lite             (2.0) - This is the lite version of 'optparse'.
configopt                 (0.2) - Command line parser and configuration line parser, using OptParse and
                            ConfigParser
configparse               (0.3) - A configfile and command-line parsing library based on optparse
twitter.common.options    (0.1.0) - twitter.common optparse wrapper.
optcomplete               (1.2-devel) - Automatic shell completion support for scripts that use optparse.
optparse_gui              (0.1) - import optparse_gui as optparse - wx gui frontend for optparse
optplus                   (0.1.1) - additional options for optparse
runfunc                   (0.0.1) - An alternative syntax for optparse
optparse2                 (0.1) -

You could change:

line = '%s (%s) - %s' % (name.ljust(name_column_width), version, summary)

into:

line = '%-*s - %s' % (name_column_width, '%s (%s)' % (name, version), summary)

or:

line = '{:<{width}} - {}'.format('%s (%s)' % (name, version), summary, width=name_column_width)k

and the output will be aligned:

oparse (0.9.2)            - oparse is a command line framework based on optparse.
wxOptParse (0.1.6)        - wxOptParse: run the command line options from a dialog box.
optparse_lite (2.0)       - This is the lite version of 'optparse'.
configopt (0.2)           - Command line parser and configuration line parser, using OptParse and ConfigParser
configparse (0.3)         - A configfile and command-line parsing library based on optparse
twitter.common.options (0.1.0) - twitter.common optparse wrapper.
optcomplete (1.2-devel)   - Automatic shell completion support for scripts that use optparse.
optparse_gui (0.1)        - import optparse_gui as optparse - wx gui frontend for optparse
optplus (0.1.1)           - additional options for optparse
runfunc (0.0.1)           - An alternative syntax for optparse
optparse2 (0.1)           - 

Maybe it's also a good idea to use == or >= instead of ().

Contributor

gvalkov commented Jan 3, 2014

Nice idea, but the list is no longer aligned:

$ pip search optparse
oparse                    (0.9.2) - oparse is a command line framework based on optparse.
wxOptParse                (0.1.6) - wxOptParse: run the command line options from a dialog box.
optparse_lite             (2.0) - This is the lite version of 'optparse'.
configopt                 (0.2) - Command line parser and configuration line parser, using OptParse and
                            ConfigParser
configparse               (0.3) - A configfile and command-line parsing library based on optparse
twitter.common.options    (0.1.0) - twitter.common optparse wrapper.
optcomplete               (1.2-devel) - Automatic shell completion support for scripts that use optparse.
optparse_gui              (0.1) - import optparse_gui as optparse - wx gui frontend for optparse
optplus                   (0.1.1) - additional options for optparse
runfunc                   (0.0.1) - An alternative syntax for optparse
optparse2                 (0.1) -

You could change:

line = '%s (%s) - %s' % (name.ljust(name_column_width), version, summary)

into:

line = '%-*s - %s' % (name_column_width, '%s (%s)' % (name, version), summary)

or:

line = '{:<{width}} - {}'.format('%s (%s)' % (name, version), summary, width=name_column_width)k

and the output will be aligned:

oparse (0.9.2)            - oparse is a command line framework based on optparse.
wxOptParse (0.1.6)        - wxOptParse: run the command line options from a dialog box.
optparse_lite (2.0)       - This is the lite version of 'optparse'.
configopt (0.2)           - Command line parser and configuration line parser, using OptParse and ConfigParser
configparse (0.3)         - A configfile and command-line parsing library based on optparse
twitter.common.options (0.1.0) - twitter.common optparse wrapper.
optcomplete (1.2-devel)   - Automatic shell completion support for scripts that use optparse.
optparse_gui (0.1)        - import optparse_gui as optparse - wx gui frontend for optparse
optplus (0.1.1)           - additional options for optparse
runfunc (0.0.1)           - An alternative syntax for optparse
optparse2 (0.1)           - 

Maybe it's also a good idea to use == or >= instead of ().

@crodjer

This comment has been minimized.

Show comment
Hide comment
@crodjer

crodjer Jan 3, 2014

Contributor

This makes sense, thanks. I'll update the PR with it.

On Fri, Jan 3, 2014 at 4:32 PM, Georgi Valkov notifications@github.com wrote:

Nice idea, but the list is no longer aligned:

$ pip search optparse
oparse (0.9.2) - oparse is a command line framework based on optparse.
wxOptParse (0.1.6) - wxOptParse: run the command line options from a dialog box.
optparse_lite (2.0) - This is the lite version of 'optparse'.
configopt (0.2) - Command line parser and configuration line parser, using OptParse and
ConfigParser
configparse (0.3) - A configfile and command-line parsing library based on optparse
twitter.common.options (0.1.0) - twitter.common optparse wrapper.
optcomplete (1.2-devel) - Automatic shell completion support for scripts that use optparse.
optparse_gui (0.1) - import optparse_gui as optparse - wx gui frontend for optparse
optplus (0.1.1) - additional options for optparse
runfunc (0.0.1) - An alternative syntax for optparse
optparse2 (0.1) -

You could change:

line = '%s (%s) - %s' % (name.ljust(name_column_width), version, summary)

into:

line = '%-*s - %s' % (name_column_width, '%s (%s)' % (name, version), summary)

or:

line = '{:<{width}} - {}'.format('%s (%s)' % (name, version), summary, width=name_column_width)k

and the output will be aligned:

oparse (0.9.2) - oparse is a command line framework based on optparse.
wxOptParse (0.1.6) - wxOptParse: run the command line options from a dialog box.
optparse_lite (2.0) - This is the lite version of 'optparse'.
configopt (0.2) - Command line parser and configuration line parser, using OptParse and ConfigParser
configparse (0.3) - A configfile and command-line parsing library based on optparse
twitter.common.options (0.1.0) - twitter.common optparse wrapper.
optcomplete (1.2-devel) - Automatic shell completion support for scripts that use optparse.
optparse_gui (0.1) - import optparse_gui as optparse - wx gui frontend for optparse
optplus (0.1.1) - additional options for optparse
runfunc (0.0.1) - An alternative syntax for optparse
optparse2 (0.1) -

Maybe it's also a good idea to use == or >= instead of ().

Should it not be <= (signifying that the versions that are available
are less than or equal to this number)?


Reply to this email directly or view it on GitHub.

Thanks
Rohan Jain

Contributor

crodjer commented Jan 3, 2014

This makes sense, thanks. I'll update the PR with it.

On Fri, Jan 3, 2014 at 4:32 PM, Georgi Valkov notifications@github.com wrote:

Nice idea, but the list is no longer aligned:

$ pip search optparse
oparse (0.9.2) - oparse is a command line framework based on optparse.
wxOptParse (0.1.6) - wxOptParse: run the command line options from a dialog box.
optparse_lite (2.0) - This is the lite version of 'optparse'.
configopt (0.2) - Command line parser and configuration line parser, using OptParse and
ConfigParser
configparse (0.3) - A configfile and command-line parsing library based on optparse
twitter.common.options (0.1.0) - twitter.common optparse wrapper.
optcomplete (1.2-devel) - Automatic shell completion support for scripts that use optparse.
optparse_gui (0.1) - import optparse_gui as optparse - wx gui frontend for optparse
optplus (0.1.1) - additional options for optparse
runfunc (0.0.1) - An alternative syntax for optparse
optparse2 (0.1) -

You could change:

line = '%s (%s) - %s' % (name.ljust(name_column_width), version, summary)

into:

line = '%-*s - %s' % (name_column_width, '%s (%s)' % (name, version), summary)

or:

line = '{:<{width}} - {}'.format('%s (%s)' % (name, version), summary, width=name_column_width)k

and the output will be aligned:

oparse (0.9.2) - oparse is a command line framework based on optparse.
wxOptParse (0.1.6) - wxOptParse: run the command line options from a dialog box.
optparse_lite (2.0) - This is the lite version of 'optparse'.
configopt (0.2) - Command line parser and configuration line parser, using OptParse and ConfigParser
configparse (0.3) - A configfile and command-line parsing library based on optparse
twitter.common.options (0.1.0) - twitter.common optparse wrapper.
optcomplete (1.2-devel) - Automatic shell completion support for scripts that use optparse.
optparse_gui (0.1) - import optparse_gui as optparse - wx gui frontend for optparse
optplus (0.1.1) - additional options for optparse
runfunc (0.0.1) - An alternative syntax for optparse
optparse2 (0.1) -

Maybe it's also a good idea to use == or >= instead of ().

Should it not be <= (signifying that the versions that are available
are less than or equal to this number)?


Reply to this email directly or view it on GitHub.

Thanks
Rohan Jain

@crodjer

This comment has been minimized.

Show comment
Hide comment
@crodjer

crodjer Jan 4, 2014

Contributor

Also, does this patch need modifications in the tests? From the one test that I looked at, it seems that this change should not break anything.

Contributor

crodjer commented Jan 4, 2014

Also, does this patch need modifications in the tests? From the one test that I looked at, it seems that this change should not break anything.

crodjer added a commit to crodjer/pip that referenced this pull request Jan 5, 2014

@crodjer

This comment has been minimized.

Show comment
Hide comment
@crodjer

crodjer Jan 17, 2014

Contributor

Updated the patch to maintain alignment in package summaries.

Contributor

crodjer commented Jan 17, 2014

Updated the patch to maintain alignment in package summaries.

Print the latest version number in search results
With the project name and summary, also mention the latest version of the
project which is present at pypi.
Useful in the scenario where developers are updating their project's
`requirements.txt` and need to compare the current upstream version against
their own installed version.

Signed-off-by: Rohan Jain <crodjer@gmail.com>

crodjer added a commit to crodjer/pip that referenced this pull request Jan 27, 2014

@crodjer

This comment has been minimized.

Show comment
Hide comment
@crodjer

crodjer Jan 27, 2014

Contributor

Rebased the changes with current develop. Ready for review. I am not 100% on using any of ==, >= or <= for version number. So still using parentheses.

Contributor

crodjer commented Jan 27, 2014

Rebased the changes with current develop. Ready for review. I am not 100% on using any of ==, >= or <= for version number. So still using parentheses.

Fix alignment for version number in search (#1415)
Thanks @gvalkov for the suggestion.

Signed-off-by: Rohan Jain <crodjer@gmail.com>
@msabramo

This comment has been minimized.

Show comment
Hide comment
@msabramo

msabramo Dec 21, 2014

Contributor

This is pretty cool, but maybe you should bump the width up for package name + version since it doesn't line up nicely when the package name is long

$ pip search pytest | tail -n 10
131228_pytest_1 (1.0.0)   - A easy printer of nested list
pytest-fixture-tools (1.0.0) - Plugin for pytest which provides tools for fixtures
mypytest (1.0)            - The descusr web application development framework, a Pylons project
py.test (0.0)             - please use 'pytest' for installation
pytest-beds (0.0.1)       - Fixtures for testing Google Appengine (GAE) apps
myPipyTest (0.0.1)        - a distributed test framework
pytest-figleaf (1.0)      - py.test figleaf coverage plugin
pytest-jira (0.01)        - py.test JIRA integration plugin, using markers
pytest-browsermob-proxy (0.1) - BrowserMob proxy plugin for py.test.
pytest-sourceorder (0.1)  - Test-ordering plugin for pytest
Contributor

msabramo commented Dec 21, 2014

This is pretty cool, but maybe you should bump the width up for package name + version since it doesn't line up nicely when the package name is long

$ pip search pytest | tail -n 10
131228_pytest_1 (1.0.0)   - A easy printer of nested list
pytest-fixture-tools (1.0.0) - Plugin for pytest which provides tools for fixtures
mypytest (1.0)            - The descusr web application development framework, a Pylons project
py.test (0.0)             - please use 'pytest' for installation
pytest-beds (0.0.1)       - Fixtures for testing Google Appengine (GAE) apps
myPipyTest (0.0.1)        - a distributed test framework
pytest-figleaf (1.0)      - py.test figleaf coverage plugin
pytest-jira (0.01)        - py.test JIRA integration plugin, using markers
pytest-browsermob-proxy (0.1) - BrowserMob proxy plugin for py.test.
pytest-sourceorder (0.1)  - Test-ordering plugin for pytest
@msabramo

This comment has been minimized.

Show comment
Hide comment
@msabramo

msabramo Dec 21, 2014

Contributor

35 seems to work pretty well though I wonder what the longest name is on PyPI. I guess it would be cool if the width were calculated dynamically.

Contributor

msabramo commented Dec 21, 2014

35 seems to work pretty well though I wonder what the longest name is on PyPI. I guess it would be cool if the width were calculated dynamically.

@msabramo

This comment has been minimized.

Show comment
Hide comment
@msabramo

msabramo Dec 21, 2014

Contributor

I guess it would be cool if the width were calculated dynamically.

See #2240

Contributor

msabramo commented Dec 21, 2014

I guess it would be cool if the width were calculated dynamically.

See #2240

msabramo and others added some commits Dec 21, 2014

Make search name column width dynamic
Before:

    $ pip search hypervisor
    archipel-agent (0.6.0beta) - The hypervisor's agent part of Archipel
    archipel-agent-hypervisor-geolocalization (0.6.0beta) - Make hypervisor able to locate themselves in the world
    archipel-agent-hypervisor-health (0.6.0beta) - Get health of hypervisors
    archipel-agent-action-scheduler (0.6.0beta) - Creation and management of planified tasks for hypervisors and virtual machines
    archipel-agent-hypervisor-network (0.6.0beta) - Manage libvirt networks
    archipel-agent-hypervisor-platformrequest (0.6.0beta) - Manage platform wide operation requests
    Hyperkit (0.2)            - Hypervisor tools

After:

    $ pip search hypervisor
    archipel-agent (0.6.0beta)                             - The hypervisor's agent part of Archipel
    archipel-agent-hypervisor-geolocalization (0.6.0beta)  - Make hypervisor able to locate themselves in the world
    archipel-agent-hypervisor-health (0.6.0beta)           - Get health of hypervisors
    archipel-agent-action-scheduler (0.6.0beta)            - Creation and management of planified tasks for hypervisors and virtual machines
    archipel-agent-hypervisor-network (0.6.0beta)          - Manage libvirt networks
    archipel-agent-hypervisor-platformrequest (0.6.0beta)  - Manage platform wide operation requests
    Hyperkit (0.2)                                         - Hypervisor tools
Merge pull request #1 from msabramo/search-pkg-version
Make search name column width dynamic
@msabramo

This comment has been minimized.

Show comment
Hide comment
@msabramo

msabramo Dec 23, 2014

Contributor

Has merge conflicts, probably because #2240 was just merged. Want to update it?

Contributor

msabramo commented Dec 23, 2014

Has merge conflicts, probably because #2240 was just merged. Want to update it?

Merge branch 'develop' into search-pkg-version
Conflicts:
	pip/commands/search.py
@crodjer

This comment has been minimized.

Show comment
Hide comment
@crodjer

crodjer Dec 27, 2014

Contributor

Merged the latest develop.

On Tuesday 23 December 2014 10:55 PM, Marc Abramowitz wrote:

Has merge conflicts, probably because #2240 was just merged. Want to update it?


Reply to this email directly or view it on GitHub:
#1415 (comment)

Thanks
Rohan Jain

Contributor

crodjer commented Dec 27, 2014

Merged the latest develop.

On Tuesday 23 December 2014 10:55 PM, Marc Abramowitz wrote:

Has merge conflicts, probably because #2240 was just merged. Want to update it?


Reply to this email directly or view it on GitHub:
#1415 (comment)

Thanks
Rohan Jain

@msabramo

This comment has been minimized.

Show comment
Hide comment
@msabramo

msabramo Jan 16, 2015

Contributor

👍

Contributor

msabramo commented Jan 16, 2015

👍

@xavfernandez xavfernandez added this to the 8.1 milestone Mar 4, 2016

xavfernandez added a commit that referenced this pull request Mar 4, 2016

Merge pull request #1415 from crodjer/search-pkg-version
Print the latest version number in search results

@xavfernandez xavfernandez merged commit 6924faa into pypa:develop Mar 4, 2016

1 check passed

continuous-integration/travis-ci The Travis CI build passed
Details
@xavfernandez

This comment has been minimized.

Show comment
Hide comment
@xavfernandez

xavfernandez Mar 4, 2016

Contributor

Thanks :)

Contributor

xavfernandez commented Mar 4, 2016

Thanks :)

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