Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/deeuu/xontrib-conda-project
Auto activate/deactive conda environments residing in a project directory
https://github.com/deeuu/xontrib-conda-project
xonsh xontrib
Last synced: 20 days ago
JSON representation
Auto activate/deactive conda environments residing in a project directory
- Host: GitHub
- URL: https://github.com/deeuu/xontrib-conda-project
- Owner: deeuu
- License: mit
- Created: 2020-03-26T17:10:56.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2022-03-10T11:59:06.000Z (over 2 years ago)
- Last Synced: 2024-07-30T21:06:33.206Z (3 months ago)
- Topics: xonsh, xontrib
- Language: Xonsh
- Homepage:
- Size: 3.91 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Xontrib Conda Project
A [xonsh](https://xon.sh/) `xontrib` to automatically activate a [`conda`](https://docs.conda.io/projects/conda/en/latest/user-guide/) environment residing in a project directory, upon moving to that directory.
For example, lets create a `conda` environment for our new project located at `~/project`
```
mkdir ~/project
cd ~/project
conda create --prefix conda-env xonsh
```With `conda-project` loaded, this environment will automatically activate when you navigate to the project
```
cd ~
which xonsh # /Users/deeuu/.local/share/virtualenvs/xonsh/bin/xonsh
cd ~/project
which xonsh # /Users/deeuu/project/conda-env/bin/xonsh
```and deactivate when you leave
```
cd ..
which xonsh # /Users/deeuu/.local/share/virtualenvs/xonsh/bin/xonsh
```By default, `conda-project` will decide to activate if a `conda-env` directory is found. You can change this by setting `$CONDA_PROJECT_DIR_NAME`.
Two useful aliases are also provided:
- `create-conda-project`: creates a `conda` environment in the current (project) directory, using an `env*.yaml` file if found. This is just a wrapper around `conda create`, so you can pass any valid arguments to this subcommand.
- `export-conda-project`: exports the `conda` environment located in the current (project) directory to `environment.yaml` (the environment does not need to be active to call this alias). This is just a wrapper around `conda env export`, so you can pass any valid arguments to this subcommand.To deactivate the service, set `$CONDA_PROJECT = False` (or remove the `xontrib`).
## Install
```
xpip install xontrib-conda-project
```Then load it by adding
```
xontrib load xontrib-conda-project
```to your `.xonshrc`.
## Links
- See the [xonsh](https://xon.sh/) website for more information about this shell, or visit the [github repo](https://github.com/xonsh/xonsh).
- You can find more xontribs and related documentation on the [project website](https://xon.sh/xontribs.html#).