-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Ignore commas in pip show, etc. #5454
Comments
Thinking about it many people skip the space after commas, (incorrectly), and this depending on context may or may not cause a problem so I would like to also split on commas as well. |
@GadgetSteve Could you provide additional context and reasoning on why doing this sort of filtering outside of pip isn't a good enough option? |
@pradyunsg This actually caught me out the other day where I was checking the licences for mayavi as above, I was considering if it would meet our rules at work and I ran: I added this, (by copy and paste), to the pip show command line thinking that I would later be able to generalize this by piping into grin, or grep, to get all the requires and then do the same to get the set of licences. To my surprise the output of: It is quite reasonable to envisage someone doing along the lines of grabbing the output of I actually thought of 3 possible solutions to this issue:
I do have to admit a distinct personal bias in that I believe that tools should except input in the format(s) that they output. To me this minimizes user confusion and the potential for error. |
PRs welcome, preferably separate. Personally I think:
It is probably as-is because the output is meant to look like metadata which uses commas in lists for some fields. Maybe there would be some backwards-compatibility concern switching to just space-separated?
I can't think of a reason why these would have been skipped, but it looks like it has been that way since the beginning. Logging warnings to stderr for packages that weren't found, maybe before any output as opposed to inline with the text, would probably be good.
I think that the proposed approach of splitting and/or dropping commas opens the door for more confusion. There are plenty of people whose focus is not on the command line, or who only need to use one or the other of e.g. |
Note that the proposed change is not to require commas in the input list but rather to allow them - this shouldn't cause as much confusion as reporting Personally I would like to see: I can see no reason for the same to be true of Simply changing in pip/_vendor/packaging/utils.py:
to:
Would do the job. |
Wondering about the scope of the required testing!
|
What's the problem this feature will solve?
Currently on using pip show on a package with multiple dependencies they are listed comma separated, e.g.:
But if, for example we wish to check the licence for all of the dependencies so copy the last line to pip show with:
>pip show apptools, envisage, numpy, pyface, pygments, traits, traitsui, vtk
it fails silently on everything butvtk
. This could easily lead the user, especially if they are using a pipe to filter the licence lines and remove duplicates, to draw the wrong conclusion.Describe the solution you'd like
It the list processing for
pip show
and other commands were to add a strip of the comma character rather than the relying user understanding what happened an performing a manual edit then the results would be as intuitively expected.In the real world example above stripping commas from the target list would have the same effect as
>pip show apptools envisage numpy pyface pygments traits traitsui vtk
Alternative Solutions
Additional context
The text was updated successfully, but these errors were encountered: