nu_scripts/modules/virtual_environments
Stijn van Houwelingen 9fc4eb0ac5
Added updated and improved version of the conda scripts (#694)
I have been using the script myself for a while, so I am fairly
confident that it works. I would prefer if I could make mamba activate
work out of the box but putting aliases in the file doesn't seem to
work, so If anyone knows how to make that work, that would be great.
2023-12-12 12:56:38 -06:00
..
auto-venv Using def --env instead of def-env (#673) 2023-11-20 06:55:35 -06:00
nu_conda Using def --env instead of def-env (#673) 2023-11-20 06:55:35 -06:00
nu_conda_2 Added updated and improved version of the conda scripts (#694) 2023-12-12 12:56:38 -06:00
nu_msvs Using def --env instead of def-env (#673) 2023-11-20 06:55:35 -06:00
conda.nu Using def --env instead of def-env (#673) 2023-11-20 06:55:35 -06:00
README.md use $env. instead of let-env (#543) 2023-07-01 10:40:16 +02:00

Virtual environment scripts

The scripts in this directory activate virtual environments for Conda environments.

Usage

The activation and deactivation commands are exported from the conda module.

> use conda.nu
> conda activate foo
[foo] > conda deactivate
>

The activate command also includes custom completions for the environment names. To disable the prompt changes (e.g., to let Starship include its own), set the environment variable CONDA_NO_PROMPT. To set it globally, add the line $env.CONDA_NO_PROMPT = true to $nu.config-path.

Limitations

(old text, not tested)

  • The "root_prefix" might not actually correspond to the correct path to the Conda envs. You can fix this for your setup by changing how the root prefix is found in the conda-env command.
  • Nested envs are not well supported. If you activate a Conda env while another one is activated, new elements will be appended to the PATH, but the other environment variables will be overwritten. There's no way to then restore the PATH to the state it was in before activating the first env (at least not with this script directly).