Skip to content

Commit

Permalink
Print the latest version number in search results
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
crodjer committed Jan 27, 2014
1 parent d1ca3f2 commit 084dcd5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pip/commands/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,13 @@ def print_results(hits, name_column_width=25, terminal_width=None):
for hit in hits:
name = hit['name']
summary = hit['summary'] or ''
version = hit.get('versions', ['-'])[-1]
if terminal_width is not None:
# wrap and indent summary to fit terminal
summary = textwrap.wrap(summary, terminal_width - name_column_width - 5)
summary = ('\n' + ' ' * (name_column_width + 3)).join(summary)
line = '%s - %s' % (name.ljust(name_column_width), summary)
line = '%s (%s) - %s' % (name.ljust(name_column_width), version,
summary)
try:
logger.notify(line)
if name in installed_packages:
Expand Down

0 comments on commit 084dcd5

Please sign in to comment.