-
Notifications
You must be signed in to change notification settings - Fork 36
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
pip list #53
pip list #53
Conversation
|
Defer all packages to be installed at once and cleanup merge artifacts.
I know you claimed that:
However, as you can see, the regular expression does not work. |
Also, I'm not messing with cram. |
Thanks for taking up on this, @xoviat. I sympathize with your reason to not include the test, so it will not stop me from accepting your PR (instead, I will try to add the test myself). I will give this a proper review today starting at 21:00 UTC+1+DST (my time zone), so about 11 hours from now. At first glance, it looks very promising. Edit for future reference: this PR resumes where #41 became suspended. |
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.
There were some minor issues with your code, but I already fixed them on feature/pip-list
. You were right that the parse_legacy
didn't work, I fixed that as well.
I will add the missing tests (for argument forwarding) and then merge and release this. Thanks for helping pip-review to reach version 1.0!
return parser.parse_args() | ||
|
||
|
||
parsed, unknown = parser.parse_known_args() #this is an 'internal' method |
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.
No, this is not an internal method, even if you quote it. It is a public, well-documented, official part of the standard library which was included precisely for our purpose. I'm glad you found it.
unknown
is a rather confusing name for a variable. I did some renaming and removed your comment in db0f0fc.
# which returns 'parsed', the same as what parse_args() would return | ||
# and 'unknown', the remainder of that | ||
# the difference to parse_args() is that it does not exit when it finds redundant arguments | ||
unknown = [arg for arg in unknown if arg.startswith(("-", "--"))] |
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.
This was a bit overly restrictive. pip has arguments that take values, such as --timeout
. The above line removes those values, causing pip list
to bail out. I fixed this in 16e8ab4.
pip_review/__main__.py
Outdated
version = package["version"] | ||
yield name, parse_version(version), version, False | ||
|
||
|
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.
Still a joy to see all those lines disappear.
pip_review/__main__.py
Outdated
if user: | ||
command.append('--user') | ||
def get_outdated_packages(unknown): | ||
command = ['pip', 'list', '--outdated'] + unknown |
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.
This was still missing a pip_cmd()
. I fixed that in 00e58ab.
pip_review/__main__.py
Outdated
if parse_version(pip.__version__) > parse_version('9.0'): | ||
command.append('--disable-pip-version-check') |
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.
This actually applies from pip>=6
onwards. I fixed that in 706840c.
if parse_version(pip.__version__) > parse_version('9.0'): | ||
command.append('--disable-pip-version-check') | ||
command.append('--format=json') | ||
output = check_output(" ".join(command)).decode('utf-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.
@jgonggrijp This must have slipped in from @bil-elmoussaoui. We do not want to do this. The command should be passed as a list.
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.
I agree it should be a list, but I vaguely recall that check_output
requires a string argument. It hasn't caused troubles yet, so it's not stopping me from rolling out the 1.0 release, but go ahead and submit a pull request if you can't stand it.
Your fix should branch off from feature/pip-list
but you should request to merge into develop
, because I locally already merged the branch. Thanks in advance if you do, no problem if you don't. I'm fine with it either way.
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.
Also, it might actually be older than the commits from @bil-elmoussaoui.
If you hadn't closed this, it would now have been displayed as merged. |
No description provided.