Evolving the pip list json output
See original GitHub issueCurrently, pip list --format=json produces a json array.
I think it could be valuable for pip list to output additional information, such as an environment object with PEP 608 environment markers, etc. Such a change would require the pip list output to evolve in a backward incompatible way, in this case because of the current array output that would need to be converted to an object.
It is to be noted that such back-ward incompatible changes will probably be very infrequent, since we’ll presumably only want to add new information to the output. An example of backward compatible change is https://github.com/pypa/pip/pull/11097 which adds a metadata property to the list items.
How should such backward-incompatible changes be addressed ?
- with a new format option such as
--format=json+v2? - with a new commend such as
pip inspect?
Issue Analytics
- State:
- Created a year ago
- Comments:9 (8 by maintainers)
Top Results From Across the Web
pip inspect JSON output specification
The pip inspect command produces a detailed JSON report of the Python environment, including installed distributions.
Read more >JSON output sorting in Python - Stack Overflow
Try OrderedDict from the standard library collections : >>> import json >>> from collections import OrderedDict >>> values ...
Read more >Pandas - Convert JSON to CSV - Spark by {Examples}
Install Pandas. If you don't have pandas on your system, install python pandas by using the pip command. skip this step. If you...
Read more >django-admin and manage.py
Run django-admin help --commands to display a list of all available commands. ... For example, to output the data as a compressed JSON...
Read more >json2html - PyPI
Convert now accepts unicode and bytestrings for the keyword argument “json”. Output now should always appear in the same order as input. Now...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I don’t like
json+v2since it implies we’ll lose the prettierjsonkey forever. Perhaps--use-feature=list-json-2022is a better way to transition?Introduing
pip inspectis a good idea if it can have more use cases, but I can’t think of any right now.Actually, it occurred to me that we may even be able to do this right now. I put together a very simple proof of concept and it seems to work. If you put the following script alongside a “lib” directory with pip installed into it (
pip install pip --target lib) but with thebinandpip*.dist-infodirectory removed (so the bundled pip isn’t visible inpip list) then it can be run from any Python interpreter to effectively act as a copy of pip in that environment.I don’t think it would take much to turn this into a viable “standalone pip” application (I’d mostly just want to set up an executable wrapper for Windows). I’ve done some very basic testing - this would need a lot more real-world testing to make sure there aren’t any problem edge cases, but it basically seems to work.