Sort "pip freeze" results by name #1602

Closed
giampaolo opened this Issue Feb 27, 2014 · 7 comments

2 participants

@giampaolo

This is a feature request.
Unless there are good reasons not to do it, I think it makes sense to have ordered package names.

@giampaolo

Maybe that is just in the development version?

(httpbench)giampaolo@UX32VD:~/svn/samsung/httpbench$ pip  --version
pip 1.5.4 from /home/giampaolo/svn/samsung/httpbench/_venv/local/lib/python2.7/site-packages (python 2.7)
(httpbench)giampaolo@UX32VD:~/svn/samsung/httpbench$ pip freeze 
PyYAML==3.10
argparse==1.2.1
docopt==0.6.1
httpbench==0.1
ipdb==0.8
ipython==1.2.1
-e hg+https://code.google.com/p/psutil@f251d96aa3f99b4bfd403e2de7360af5d7566222#egg=psutil-dev
requests==2.2.1
wsgiref==0.1.2
@Ivoz
Python Packaging Authority member

No, been around for a while. If you think it should use a different key comparison, please say so so we can consider.

@giampaolo

Are you able to reproduce the issue though?

@Ivoz
Python Packaging Authority member

Which issue? As in normal python string comparison, capital letters come before lowercase. e.g:

(cryptography)ivo@ivosung cryptography (master)$ pip freeze
Jinja2==2.7.2
MarkupSafe==0.18
Pygments==1.6
Sphinx==1.2.1
cffi==0.8.1
cov-core==1.7
coverage==3.7.1
-e git+git@github.com:Ivoz/cryptography.git@bd08799bcce99b94250ad3b3313826651c8c0181#egg=cryptography-pyca/master
docutils==0.11
enum34==0.9.23
flake8==2.1.0
mccabe==0.2.1
pep8==1.4.6
pretend==1.0.7
py==1.4.20
pycparser==2.10
pyflakes==0.7.3
pytest==2.5.2
pytest-cov==1.6
six==1.5.2
tox==1.7.0
virtualenv==1.11.4
wheel==0.22.0
wsgiref==0.1.2

Everything sorted alphabetically

@giampaolo

Mmm you're right, I clearly got confused, sorry.
But yes, I'd like to propose a change in order to avoid having capital letters visually separated from others as in:

>>> sorted(ls, key=lambda x: x.lower()))

This way we'd also have "-e " lines at the top of the list instead of in the middle.
This is going to be the result which IMO is more readable:

-e git+git@github.com:Ivoz/cryptography.git@bd08799bcce99b94250ad3b3313826651c8c0181#egg=cryptography-pyca/master
cffi==0.8.1
cov-core==1.7
coverage==3.7.1
docutils==0.11
enum34==0.9.23
flake8==2.1.0
Jinja2==2.7.2
MarkupSafe==0.18
mccabe==0.2.1
pep8==1.4.6
pretend==1.0.7
py==1.4.20
pycparser==2.10
pyflakes==0.7.3
Pygments==1.6
pytest-cov==1.6
pytest==2.5.2
six==1.5.2
Sphinx==1.2.1
tox==1.7.0
virtualenv==1.11.4
wheel==0.22.0
wsgiref==0.1.2
@qwcode qwcode closed this in #1605 Mar 8, 2014
@giampaolo

thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment