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 simple order strategy for result of search command #4131
Conversation
p = re.compile(query) | ||
p_ignorecase = re.compile(query, re.IGNORECASE) | ||
for index, item in enumerate(hits): | ||
hits[index]['match_score'] = 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for any use of hits[index]
you can just use item
the enumerate is also unnecessary then
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry, the habbit took from php :-)
for index, item in enumerate(hits): | ||
hits[index]['match_score'] = 0 | ||
name = item['name'] | ||
summary = item['summary'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just use summary = item['summary'] or ''
there should be a few unit-tests for the function - at first glance it seems potentially fragile |
from __future__ import absolute_import | ||
|
||
import logging | ||
import sys | ||
import textwrap | ||
import re |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Global imports should be alphabetically ordered
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it. Modified.
It feels like you are trying to shove into pip improvements to the search currently happening in PyPI and that will soon happen in warehouse. |
@@ -1,6 +1,8 @@ | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unnecessary.
Could you add a news file for this? |
Hello! I am an automated bot and I have noticed that this pull request is not currently able to be merged. If you are able to either merge the |
Closing due to lack of a response. |
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. |
Mostly, I use "pip search" just with a package name that I want to install. I just want to make sure that the name is correct. But most of the time, the result is very confused. I add a small ordering strategy on search result by giving them a score. The solution is very elementary. But, at least, if I did search with the exactly package name, that package would come at the very first line. I'm using this version of pip search on my own laptop for a while. Till now, it works fine. :-)