conda icon indicating copy to clipboard operation
conda copied to clipboard

Support for global activation of an environment (similar to `pyenv global`)

Open mykolav opened this issue 1 year ago • 2 comments

Checklist

  • [X] I added a descriptive title
  • [X] I searched open requests and couldn't find a duplicate

What is the idea?

Would it be possible to add support for global activation of an environment?

I'm thinking of a feature that, from the user's perspective, would work the same as pyenv global.

If the user activates an environment global_env1 globally, it isn't isolated withing the shell session where it was activated: if the user opens another shell window, the shell will start with global_env1 activated. If the user opens a GUI application from their window manager's menu, that app will start "within" global_env1.

Why is this needed?

  1. Activating the same environment in every shell window or tab is an inconvenience. But this isn't really a big deal.
  2. Activating a desired environment for a GUI app which uses python to carry out some of its functions and was started using the window manager (in contrast to starting it from a cli), might be simply impossible. One specific example of this is Clang. When working with its source code in Visual Studio, it let's you run the tests from it. And the test runner is based on python.

What should happen?

Here's an example of how pyenv global works:

  1. I open a shell window and execute

    pyenv global 3.113
    

    Assuming, python 3.11.3 has been installed through pyenv earlier, this command "activates" it. So, If I now execute python --version in the current shell window, I'll get Python 3.11.3 in response.

  2. I close the original shell window and open a new one. If I execute

    python --version
    

    I still get Python 3.11.3 in response.

  3. I can now close the second shell window and start a GUI program from my window manager's menu. Let's say I started Visual Studio in this way. A project I would like to work on in this instance of Visual Studio executes python as a build step or to run tests. (For a specific example of this, please, take a look at Clang's Testing using Visual Studio on Windows) The python executable that VS is going to use is the version I activated globally at the step one.

Additional Context

No response

mykolav avatar Jun 21 '23 17:06 mykolav