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

list: Add --clean for portable output #392

Closed
wants to merge 1 commit into from
Closed

list: Add --clean for portable output #392

wants to merge 1 commit into from

Conversation

SanketDG
Copy link

No description provided.

@cs01
Copy link
Member

cs01 commented May 11, 2020

Thanks for the PR. I am curious, is there a technical reason this needs to be added or is this more of a preference thing? I think I would lean toward the flag being named --portable.

@PratikBhusal
Copy link
Contributor

Rather than clobber list with more options, I'd suggest making a new command export (name is a work in progress) that would work similar to pix runpip MAIN_APP freeze. Futhermore, it should be easy to export the output into either standard pip freeze output or what could be stored inside a Pipfile for example.

If we go into exporting in Pipfile format, I'd suggest only exporting the main app name and the name of all the injected apps. This might also be a good idea to do with a psedudo pip-freeze aproach where we only show the bear minimum to recreate the virtual enviroment.

@uranusjr
Copy link
Member

uranusjr commented May 11, 2020

For some context, there’s actually talk that pip may deprecate freeze as a standalone command, since it is too similar with list, and it’s difficult to tell their differences from the command names.

It does make logical sense to combine this export functionality with list. --clean is likely not the best way to do it, however, since it does not explain the intention well—why is a clean output related to machine friendliness and portability? It may be more desirable to have something akin to pip list --format, e.g.

  • pipx list with no flags: Human readable, table-ish format
  • --format=export: Machine-friendly output
  • --format=json: Human readable, JSON format
  • --format=export,json: Machine-friendly, JSON format

There are other ways to achieve similar results, but the most important thing is to make the options extendable, composible, and descriptive.

@PratikBhusal
Copy link
Contributor

@uranusjr do you have a source about the deprecation? That feeling like an interesting read and could be a nice guide for something like this.

@uranusjr
Copy link
Member

@PratikBhusal I don’t have a canonical source, sorry. It’s mainly informal conversations scattered around in the issue tracker. pypa/pip#7157 is one of them, but there are others. IIRC there’s one proposing a new pip inspect command to replace both list and freeze as well, but I can’t seem to find it now. Or maybe I remembered wrong.

@bcatubig
Copy link

bcatubig commented Jun 5, 2020

I'll chime in and add that I'd like to list on an individual venv. Having a --json flag as well for parsing would also be a nice add.

pipx list --include-injected --json ansible

@mjpieters
Copy link

I was looking for similar commands. More generally, being able to introspect pipx with other tools, being able to list pipx metadata without having to parse the human-readable output of the pipx command-line tools or having to rely on the pipx_metadata.json files would be a huge boon.

@cs01
Copy link
Member

cs01 commented Jul 14, 2020

Since there are a few use cases for various output formats, I like the idea of a --format flag with choices like @uranusjr mentioned. If this clean format could be changed to --format=export, I will merge this PR as it will also set us up for --format=json.

@SanketDG
Copy link
Author

Since there are a few use cases for various output formats, I like the idea of a --format flag with choices like @uranusjr mentioned. If this clean format could be changed to --format=export, I will merge this PR as it will also set us up for --format=json.

Sure!

I should be able to get back to this soon.

@itsayellow
Copy link
Contributor

If this is meant for some sort of future import command, we should also list the versions of the injected packages. I wonder if that should be the default behavior anyway for --include-injected so it matches the how the main package is displayed.

@itsayellow
Copy link
Contributor

Also if this is meant to be able to import in the future, shouldn't we just dump the entirety of each venv's PipxMetadata into the json? Like a list of all the PipxMetadata instances.

@itsayellow itsayellow linked an issue Jul 26, 2020 that may be closed by this pull request
@itsayellow
Copy link
Contributor

Related: #109

Copy link
Contributor

@gaborbernat gaborbernat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comments above needs addressed and merge conflicts resolved.

@gaborbernat
Copy link
Contributor

Closing due to inactivity, @SanketDG if you want to pick this up again we can reopen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

list installed packages in more version control friendly format
8 participants