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

pip freeze-like option for pipx list #224

Closed
wants to merge 2 commits into from
Closed

Conversation

clbarnes
Copy link
Contributor

@clbarnes clbarnes commented Sep 24, 2019

The first half of #109 and #156 .

Adds a --freeze option to pipx list, which prints information in the same format as pip freeze / requirements.txt. Unlike pip freeze, it does not capture all the packages' dependencies (because that wouldn't make any sense here). Like pip freeze, it only stores the package name and version, not capturing python/ platform restrictions, non-PyPI sources etc. This could possibly be addressed in a post- #222 world.

Nor does it deal with injected packages.

Next would be adding a --requirement option to pipx install, which will parse a requirements file and run commands.install for each. At that point I would also be inclined to add other ways to install multiple packages at once (e.g. pip install package1 package2 package3, pip install package1 packge2 --spec spec1 --spec spec2).

P.S. Fantastic project and a great codebase to work in!

Each subparser is added in its own function
If `--freeze` is supplied, print package information in a format
compatible with requirements files, like `pip freeze`.

Note that all pipx packages are listed, regardless of their associated
python version.
Like `pip freeze`, development packages and those installed from
non-pypi sources will simply have their name and version listed.
@clbarnes
Copy link
Contributor Author

Hmm, I'm leaning away from this implementation due to the lack of injection handling. It may be better to focus on a serialisation format like that used in the pipxrc.

@cs01
Copy link
Member

cs01 commented Oct 9, 2019

Thanks for doing this!

I am also thinking a pipxrc will supplant the need for this. I'll wait to close this out until pipxrc in merged though.

I like the way you updated the way argument parsers are added. If you want to split that into its own PR I will merge it.

@clbarnes
Copy link
Contributor Author

I like the way you updated the way argument parsers are added. If you want to split that into its own PR I will merge it.

Done, see #239

@pylipp
Copy link
Contributor

pylipp commented Mar 3, 2020

Are there intensions to revive the --freeze option?

@cs01
Copy link
Member

cs01 commented Mar 4, 2020

Metadata is now saved in the respective virtual environments, but it's not accessible by the user, only behind the scenes by pipx. There are no plans to revive it. What are you trying to accomplish with it?

@pylipp
Copy link
Contributor

pylipp commented Mar 4, 2020

I'm having the same scenario as described in #109 which links to this PR.

@pylipp
Copy link
Contributor

pylipp commented Mar 10, 2020

I want to be able to re-install any apps managed by pipx on a vanilla system. Should I backup the metadata files in the venvs for this purpose?

@cs01
Copy link
Member

cs01 commented Mar 11, 2020

Should I backup the metadata files in the venvs for this purpose?

Yes that should come close. But there is no easy way to recreate the venvs and move the metadata files back into them though, so that will have to be done manually. Also, absolute paths are stored in the metadata files so they may not translate well to different machines. Other than that it should work fine.

@pylipp
Copy link
Contributor

pylipp commented Mar 12, 2020

Also, absolute paths are stored in the metadata files so they may not translate well to different machines.

Is this one of the reasons to not have a --freeze option? From other issues I conclude that it's not the most uncommon use case (#109, #156). I'm happy to contribute an extension (it sounds like the freeze functionality can be exposed rather easily).

@cs01
Copy link
Member

cs01 commented Mar 12, 2020

Yeah it definitely seems like a useful feature that I'd be open to. I think the way to do it is first update the metadata format to not record the full path, but rather record relative paths. Then join them with the venv dir or bin dir, at runtime as necessary.

After the metadata change is made, it will be pretty straightforward to add the freeze command. @pylipp i f you want to give it a shot that would be awesome.

cc @itsayellow if you have any thoughts or have already started working on this.

@cs01
Copy link
Member

cs01 commented Mar 12, 2020

We should probably move this conversation back to #109.

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.

3 participants