Skip to content

pip list in JSON format does not contain location for editable installs #7664

Closed
@ThimoNeubauer

Description

@ThimoNeubauer

Environment

  • pip version: 20.0.2
  • Python version: 3.8.1
  • OS: Windows 10

Description

If a package is installed with pip install -e then the output of pip list contains a location column, e.g.:

E:\temp>foo\Scripts\python.exe -m pip list
Package    Version Location
---------- ------- ------------------
pip        20.0.2
setuptools 45.1.0
six        1.14.0  e:\temp\six-1.14.0

I'd like to use the location information to know which packages are in "editable" mode. Parsing the column format doesn't seem a smart idea, that's what the JSON output is for. However the location parameter is missing in JSON mode:

E:\temp>foo\Scripts\python.exe -m pip list --format json
[{"name": "pip", "version": "20.0.2"}, {"name": "setuptools", "version": "45.1.0"}, {"name": "six", "version": "1.14.0"}]

Expected behavior

I'd expect to see:

E:\temp>foo\Scripts\python.exe -m pip list --format json
[{"name": "pip", "version": "20.0.2"}, {"name": "setuptools", "version": "45.1.0"}, {"name": "six", "version": "1.14.0", "location": "e:\\temp\\six-1.14.0"}]

to match the pip list --format columns output

How to Reproduce

  1. create venv
  2. run python -m pip install --upgrade pip setuptools to be sure to use the latest and greatest versions
  3. python -m pip install -e a source package. For the output above I downloaded the latest six source
  4. run python -m pip list and compare with python -m pip list --format json to see that the location data is missing

Output

E:\temp>mkdir foo

E:\temp>py -3 --version
Python 3.8.1

E:\temp>py -3 -m venv foo

E:\temp>foo\Scripts\python -m pip install --upgrade pip setuptools
Collecting pip
  Using cached https://files.pythonhosted.org/packages/54/0c/d01aa759fdc501a58f431eb594a17495f15b88da142ce14b5845662c13f3/pip-20.0.2-py2.py3-none-any.whl
Collecting setuptools
  Using cached https://files.pythonhosted.org/packages/a7/c5/6c1acea1b4ea88b86b03280f3fde1efa04fefecd4e7d2af13e602661cde4/setuptools-45.1.0-py3-none-any.whl
Installing collected packages: pip, setuptools
  Found existing installation: pip 19.2.3
    Uninstalling pip-19.2.3:
      Successfully uninstalled pip-19.2.3
  Found existing installation: setuptools 41.2.0
    Uninstalling setuptools-41.2.0:
      Successfully uninstalled setuptools-41.2.0
Successfully installed pip-20.0.2 setuptools-45.1.0

E:\temp>curl https://files.pythonhosted.org/packages/21/9f/b251f7f8a76dec1d6651be194dfba8fb8d7781d10ab3987190de8391d08e/six-1.14.0.tar.gz --output six.tgz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 33857  100 33857    0     0   321k      0 --:--:-- --:--:-- --:--:--  324k

E:\temp>"c:\Program Files\7-Zip\7z.exe" x six.tgz

7-Zip 18.05 (x64) : Copyright (c) 1999-2018 Igor Pavlov : 2018-04-30
...

E:\temp>"c:\Program Files\7-Zip\7z.exe" x dist\six-1.14.0.tar

7-Zip 18.05 (x64) : Copyright (c) 1999-2018 Igor Pavlov : 2018-04-30
...

E:\temp>foo\Scripts\python -m pip install -e six-1.14.0
Obtaining file:///E:/temp/six-1.14.0
Installing collected packages: six
  Running setup.py develop for six
Successfully installed six

E:\temp>foo\Scripts\python -m pip list
Package    Version Location
---------- ------- ------------------
pip        20.0.2
setuptools 45.1.0
six        1.14.0  e:\temp\six-1.14.0

E:\temp>foo\Scripts\python -m pip list --format json
[{"name": "pip", "version": "20.0.2"}, {"name": "setuptools", "version": "45.1.0"}, {"name": "six", "version": "1.14.0"}]

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions