-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Fixed issue#949 #4414
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
Fixed issue#949 #4414
Conversation
I'm not sure we wan't to keep adding |
Yeah, I'm a bit concerned about this too. I don't want to over-generalise just for the sake of it, but adding extra columns isn't really what I'd expect |
To make it simple and functional. Does it make sense to just show both location and installer of a package when "pip list -v" ? |
Is this way a little complicated? I guess it's better to keep it as simple as possiple. |
OK, I'm confused here. The build has failed because a Distribution object has no "installer" attribute, which is correct. How were you planning on getting the installer metadata? You probably want something like Actually, I'm concerned about the scope creep here. As @xavfernandez pointed out, what's to stop someone else asking for another field to be added? At the end of the day, from pkg_resources import working_set
for dist in working_set:
print(f"{dist.project_name} {dist.version} {dist.location}") (with a bit of layout added). |
@pfmoore Thanks. I read the source code and find it can get 'installer' attribute in 'show' command and make a mistake to think package has the 'installer' attribute. Yes, I agree. It should stop someone else asking for another field to be added, because it will make the 'list' command completed. Then, how should we deal with issue#949 ?Does it make sense to just show both location and installer of a package when "pip list -v", then stop add more columns and encourage users write their own script. Because install location and installer are importance information of a package. Or we should close issue#949? |
The comments in #949 note that BTW, I just noticed that |
@pfmoore Yes, it is not simple. I will think it again. Thanks for advice patiently. |
pip/commands/list.py
Outdated
@@ -237,8 +244,9 @@ def output_package_listing(self, packages, options): | |||
elif options.list_format == 'freeze': | |||
for dist in packages: | |||
if options.verbose >= 1: | |||
logger.info("%s==%s (%s)", dist.project_name, | |||
dist.version, dist.location) | |||
logger.info("%s==%s (%s) (%s)", dist.project_name, |
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'm not sure it makes sense to include the installer (and the location, fwiw) in the freeze
format.
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 think it's reasonable to remove installer from freeze format too.
pip/commands/list.py
Outdated
if options.outdated: | ||
info['latest_version'] = six.text_type(dist.latest_version) | ||
info['latest_filetype'] = dist.latest_filetype | ||
data.append(info) | ||
return json.dumps(data) | ||
|
||
|
||
def get_installer(dist): |
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 function should go to pip.utils.packaging
@luojiebin Thanks 👍 |
Added a way to distinguish between pip installed packages and those from
the system package manager in 'pip list'. Specifically, 'pip list -vv' also
shows the installer of package.