11# Conda Module for Nushell
2- A simple module for activating and deactivating Conda environments.
2+ A simple module for finding, listing, activating, and deactivating Conda environments.
33
44
55## Prerequisites
6- - [ nushell] ( https://github.com/nushell/nushell ) >= 0.94.0
6+ The following commands must be available in your version of Nushell:
7+ - [ job] ( https://www.nushell.sh/commands/docs/job.html )
8+ - [ std-rfc/kv] ( https://github.com/nushell/nushell/blob/main/crates/nu-std/std-rfc/kv/mod.nu )
79
810
911## Installation
@@ -12,16 +14,18 @@ Put `nu_conda.nu` into the module folder of your nushell configuration workspace
1214
1315## Usage
1416``` nu
15- use nu_conda.nu # activate module
16- nu_conda activate py36 # activate a Conda environment, e.g. py36
17- nu_conda deactivate # deactivate the activated Conda environment
18- nu_conda list # list available environments, same as `$env.CONDA_ENVS`
17+ use nu_conda.nu # import module, Conda environments will be searched
18+ nu_conda activate py310 # activate a Conda environment, e.g. py310
19+ nu_conda deactivate # deactivate the activated Conda environment
20+ nu_conda find # find/update available environments
21+ nu_conda list # list available environments, same as `$env.CONDA_ENVS`
1922```
2023
2124## How It Works
22- This module re-implements the activation and deactivation functionalities of
23- the [ conda.nu] ( https://github.com/Neur1n/nu_scripts/blob/main/virtual_environments/conda.nu )
24- module while providing a better performance, but not fully replacing it.
25+ > [ !NOTE]
26+ > Originally, this module cached Conda environment information during import,
27+ > which increased startup time. It now performs the caching in a background
28+ > job, significantly reducing startup latency.
2529
2630This module adds paths of a target Conda environment to ` PATH ` /` Path ` while
2731activating the environment, and recover the original ` PATH ` /` Path ` while
@@ -30,13 +34,13 @@ deactivating an environment. Several environment variables are exported:
3034- ` CONDA_BASE_PATH ` : The original ` PATH ` /` Path ` before any activation/deactivation.
3135- ` CONDA_ROOT ` : Root directory of Conda installation.
3236- ` CONDA_ENVS ` : Available Conda environments for activation.
33- - ` CONDA_CURR ` : Current activated Conda environments .
37+ - ` CONDA_CURR ` : Current activated Conda environment .
3438
3539
3640## FAQ
3741** Q** : How better is the performance?\
38- ** A** : Activating a Conda environment costs ~ 20ms while conda.nu costs ~ 1500ms on
39- a PC with Windows 10 Enterprise OS and Intel i7-8700 3.20GHz CPU.
42+ ** A** : Activating a Conda environment costs ~ 20ms while conda.nu costs ~ 1500ms
43+ on a PC with Windows 10 Enterprise OS and Intel i7-8700 3.20GHz CPU.
4044
4145** Q** : How to show the current Conda environment in the prompt?\
4246** A** : This module does not automatically change the prompt when a Conda
@@ -46,15 +50,14 @@ prompt.
4650
4751
4852** Q** : Does it support Mamba/Micromamba?\
49- ** A** : As [ Mamba's documentation] ( https://mamba.readthedocs.io/en/latest/ ) said,
50- ` mamba ` is drop-in replacement for ` conda ` , and ` micromamba ` seems to be
53+ ** A** : As [ Mamba's documentation] ( https://mamba.readthedocs.io/en/latest/ )
54+ said, ` mamba ` is drop-in replacement for ` conda ` , and ` micromamba ` seems to be
5155another thing. This module only uses results of ` conda/mamba info --envs --json ` .
52- Therefore, I would say Mamba is (partially?) supported but I'm not sure about
53- Micromamba.
56+ Therefore, I would say Mamba is supported, but I'm not sure about Micromamba.
5457
5558
5659** Q** : How does it choose between Conda and Mamba?\
57- ** A** : This module prefers calling ` mamba ` than ` conda ` , but it should be very
60+ ** A** : This module prefers calling ` mamba ` over ` conda ` , but it should be very
5861easy to change the preference by modifying the source code.
5962
6063
0 commit comments