Skip to content
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

New pip list column: Editable project location #10245

Closed
sbidoul opened this issue Jul 31, 2021 · 7 comments · Fixed by #10249
Closed

New pip list column: Editable project location #10245

sbidoul opened this issue Jul 31, 2021 · 7 comments · Fixed by #10249
Assignees
Labels
C: editable Editable installations

Comments

@sbidoul
Copy link
Member

sbidoul commented Jul 31, 2021

What's the problem this feature will solve?

When running pip list, the location field/column contains the location where the project is installed.
It is, roughly, the parent directory of the .(egg|dist)-info directory.

When running pip list, (or pip freeze, see also #10243), we are mainly interested in the project directory, not the metadata directory.

With setuptools editables, the issue is not acute, because the .egg-info directory is in or below the project directory.
With PEP 660 editables, the metadata directory is in the the target environment and that location does not help finding the project directory.

Describe the solution you'd like

I propose adding a new column / json field in pip list output, named Project location / project_location.
The Location column keeps the same meaning but is only displayed in verbose mode.
The Project location column is only displayed when there are editable distributions.

Alternative Solutions

None

@sbidoul sbidoul added the C: editable Editable installations label Jul 31, 2021
@sbidoul sbidoul self-assigned this Jul 31, 2021
@sbidoul
Copy link
Member Author

sbidoul commented Jul 31, 2021

This would be an alternative to #7670 to close #7664.

@uranusjr
Copy link
Member

Maybe we should deprecate Location and add two new fields Metadata Location and Module Location. Both Location and Project Location are confusing names to me, and I don't think I would be able to tell which is which if you ask me an hour later.

@sbidoul
Copy link
Member Author

sbidoul commented Jul 31, 2021

Module location does not make me immediately think to the directory containing pyproject.toml ? At least less so than Project location ?

@sbidoul
Copy link
Member Author

sbidoul commented Jul 31, 2021

My post was possibly unclear: location is not the metadata directory but its parent (in most case, if we exclude zip distributions).

@uranusjr
Copy link
Member

My mental model for metadata directory is "the directory that contains the metadata directory", and same goes for module directory. "Module" is definitely still not a very good name, but project is also ambiguous (and not a word we use much in the UI right now?) For pure-Python projects maybe "source distribution" makes sense, but not for packages installed from a binary wheel. Naming is hard…

@sbidoul
Copy link
Member Author

sbidoul commented Aug 1, 2021

So in #10249 I'm naming the new column Editable project location (editable_project_location in the json output).

The default column output has therefore some changes in column titles (Location becomes Editable project location in non-verbose mode, and there is a new optional Editable project location column in verbose mode). I hope this has not to be considered a breaking change. I preserved the column order, in case anyone tried to parse the column output...

In the json output, there is a new field editable_project_location that only appears for editable projects. There is a minor breaking change in the sense that the location field that was output in verbose mode for all items or for editable projects only in non-verbose mode, is now only output in verbose mode. So people who relied on running pip list --format=json in non verbose mode to detect editable installs will need to change to rely on editable_project_location.

I think this is a good compromise, but I'm open to alternatives, of course.

[updated: there is no breaking change]

@sbidoul sbidoul changed the title New pip list column: Project location New pip list column: Editable project location Aug 8, 2021
@sbidoul
Copy link
Member Author

sbidoul commented Aug 8, 2021

Updated previous comment, as there is actually no breaking change as the existing json fields do not change semantics at all.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 22, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
C: editable Editable installations
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants