justinmayer / virtualfish

Fish shell tool for managing Python virtual environments
MIT License
1.06k stars 100 forks source link

Improve `vf install` behavior when already installed #162

Closed zx8 closed 4 years ago

zx8 commented 4 years ago

According to https://virtualfish.readthedocs.io/en/latest/plugins.html, vf install <plugin> should work, however I get:

$ vf install auto_activation
VirtualFish is already installed! Hooray!

Version is 2.0.1.

justinmayer commented 4 years ago

On Apr 3, 2020, at 7:05 PM, zx8 wrote: According to https://virtualfish.readthedocs.io/en/latest/plugins.html, vf install should work, however I get:

$ vf install auto_activation VirtualFish is already installed! Hooray! I think this comes down to your expectations and/or your definition of “work”.

As noted in the install docs...

https://virtualfish.readthedocs.io/en/latest/install.html#installing

... plugin installation is ostensibly meant to occur at the same time as installing VirtualFish itself, at which point the message you saw would never have been displayed.

I’m not suggesting that what you are seeing isn’t confusing, or that it isn’t evidence of something problematic. So, to start, if you open a new terminal session, does it seem as if directory-based auto-activation is functioning as expected?

zx8 commented 4 years ago

Got it, thanks. All working now.

Uninstalled & reinstalled from scratch with vf install auto_activation (rather than just vf install, and then vf install auto_activation later on).

Prodeguerriero commented 4 years ago

Hi there,

I know this was closed already, but I bumped into the same behavior and I thought I would voice my opinion. Today I have been spending some time battling issues with fish and python after I upgraded to MacOS Catalina, and this was one of the things that confused me a bit. :P

I think the docs do not explain what should be the expected outcome of running vf install <plugin> even if vf install was already used and the loader already installed. I see two options:

In either case, I suggest to make it clear in the documentation. And if the expected outcome is #2, then I'd suggest changing the stdout message to something other than VirtualFish is already installed! Hooray!

Cheers and apologies again for resurrecting this.

justinmayer commented 4 years ago

Hi Gabriele. Thanks for reaching out. Even if the VirtualFish loader has already been installed, I imagine that the optimal outcome of running vf install <plugin> would be to ensure that the specified plugin is enabled (i.e., included in the loader).

I agree that this situation could be improved, as I mentioned in my last comment above. Is this something you would like to help out with? We could certainly use the assistance. 😬

Prodeguerriero commented 4 years ago

Hi Justin,

I am not really a programmer, so I don't know how I could be of use, but I could give it a shot. I am also in the middle of figuring out some weird stuff happening with my machine at the moment. (see here)

But back to the topic, just so that we are on the same page, when you say

Even if the VirtualFish loader has already been installed, I imagine that the optimal outcome of running vf install would be to ensure that the specified plugin is enabled (i.e., included in the loader).

are you referring to the UX, so the feedback given by stdout, or the underlying behavior of VirtualFish? In other words, is installing the a plugin after installing the loader supposed to work, regardless of the message given on the terminal window?

justinmayer commented 4 years ago

I was referring to the underlying behavior, which I think should already be in place. Looking at what I imagine to be the relevant code, I think it merely overwrites the loader file on every vf install invocation: https://github.com/justinmayer/virtualfish/blob/6907653c077bd31d5cbba9578a605fa16eab6ea1/virtualfish/loader/installer.py#L11-L18

But if that's not what happens, we should ensure that any new specified plugins are indeed enabled.

Regarding what is printed to stdout, I agree that what is communicated to the user on the console could be improved and would welcome your assistance with that.

Regarding your programming experience, I wouldn't worry about that. If you are clever enough to be using Python, Fish, and VirtualFish, then you have all the building blocks needed to roll up your sleeves, read some code, and tinker. I believe in your ability to learn! :sparkles:

With that in mind, would you be willing to help out with this?

Prodeguerriero commented 4 years ago

Sure, I can give it a go. My git skills are a bit limited, but it is worth trying. Do you have any other communication channel we can use besides commenting on this issue?

hofstee commented 4 years ago

I also got stumped by this for a little bit, but I think it's because the old version of virtualfish I was using was 1.??? which had a different way of handling plugins.

I think you can get 80% of the way there by making vf install do $VIRTUALFISH_PYTHON_EXEC -m virtualfish.loader.cli install, but there are a few behaviors to be careful of:

Would be happy to help.

justinmayer commented 4 years ago

@hofstee: Good suggestions. I agree with all of the above. Of course we'll need a plan B in case $VIRTUALFISH_PYTHON_EXEC isn't defined, but presumably that is an edge case that shouldn't be encountered too often. Your help with this would be much appreciated. 👍

@Prodeguerriero: Your assistance would also be most welcome. I can't think of any appropriate alternative communication channels at the moment, although of course you can always follow me and we can discuss further via direct messages.

cycomanic commented 4 years ago

I just stumbled over this as well. Currently the documentation is a bit unclear (in particular the part for the plugins section). I assumed running vf install auto_activation even after installing vf previously would install the plugin, which was not the case. I can have a stab at this, if you'd except a merge.

justinmayer commented 4 years ago

@cycomanic: That would be great. This is certainly an area in which we could use the assistance. Thank you, Jochen!

justinmayer commented 4 years ago

Thanks to @cycomanic, the new addplugins and rmplugins sub-commands have been added to address this issue. I just released VirtualFish 2.3, which includes those new commands.