asdf-community / asdf-python

Python plugin for the asdf version manager
https://github.com/asdf-vm/asdf
MIT License
665 stars 58 forks source link

Support re-install\auto-install of default pip global packages #52

Closed brennanfee closed 5 years ago

brennanfee commented 5 years ago

It would be a great feature if when a new Python is installed (or the existing one is being upgraded) that a list of default "global" packages could be installed. Perhaps use a config file like $HOME/.default-pip-packages or something to that effect. The Node asdf plugin supports this and it is really convenient for command-line tools you always want installed from PIP (like youtube-dl for instance).

danhper commented 5 years ago

Thanks for mentioning this. If you have time to send a PR I would be more than happy to merge it. Thank you!

AlJohri commented 5 years ago

@brennanfee in this particular might I suggest preferring brew install youtube-dl for such CLI tools so they are not affected by the changing versions of python. If a homebrew package doesn't exist, pipx is also a great alternative for globally available CLI tools.

Otherwise, 👍 on automatically installing packages by default globally. rbenv and pyenv do the same: https://github.com/rbenv/rbenv-default-gems https://github.com/jawshooah/pyenv-default-packages

EDIT: oh my I just assumed you have a mac! apologies if you don't. the pipx suggestion still works.

brennanfee commented 5 years ago

brew install youtube-dl

I don't use Mac. :wink:

AlJohri commented 5 years ago

Haha yup- see my edit above.

pipx install youtube-dl

is a good alternative. It’s the successor to pipsi if you’ve used that before.

brennanfee commented 5 years ago

@AlJohri Thanks for the suggestion on pipx... I was a pipsi fan but have since started switching to pipx. Problem is that, at present, pipx doesn't play nice with asdf which I need to dig into and figure out.

As for what should happen with this suggestion... I think perhaps the only thing is the documentation should be updated to direct people to things like brew or pipx which are better for "tool installations" anyway. I thought of it only because ruby gems has a thing like that and I thought python parity would be a good idea.

danhper commented 5 years ago

pipx doesn't play nice with asdf

I never had any trouble with asdf and pipx. Could you please open an issue describing the problem you are getting? Thanks.

brennanfee commented 5 years ago

It is a very specific issue with asdf inside a Windows Subsystem For Linux shell and I belief it is an asdf symlink issue not an issue with pipx. I'm close to tracking it down and will likely submit a PR to asdf or to the WSL team (depending on where the problem lies).

Just FYI... it seems to have an issue if the symlink crosses the linux\windows divide.

essh commented 5 years ago

FYI an attempt to support this seems to have landed in https://github.com/danhper/asdf-python/pull/39. It is however not documented and doesn't seem to work correctly.

I have opened a PR (https://github.com/danhper/asdf-python/pull/59) that resolves these issues.

brennanfee commented 5 years ago

Excellent. I think it is good to offer as a feature regardless. Some will use it, some won't. I'll leave it up to you and the other moderators as to what happens to this ticket.

danhper commented 5 years ago

Thanks to @essh I think this can now be closed.