support conda
This commit is contained in:
parent
83ab314b77
commit
c66dd5a9f3
3 changed files with 34 additions and 0 deletions
|
@ -3,6 +3,19 @@ Python
|
||||||
|
|
||||||
Enables local Python and local Python package installation.
|
Enables local Python and local Python package installation.
|
||||||
|
|
||||||
|
Settings
|
||||||
|
--------
|
||||||
|
|
||||||
|
This module supports virtual environments from conda and virtualenvwrapper. By default, only virtualenvwrapper is enabled. To disable virtualenvwrapper, add the following to *zpreztorc*.
|
||||||
|
|
||||||
|
zstyle ':prezto:module:python' skip-virtualenvwrapper-init 'on'
|
||||||
|
|
||||||
|
Conda support is enabled by adding the following to *zpreztorc*.
|
||||||
|
|
||||||
|
zstyle ':prezto:module:python' conda-init 'on'
|
||||||
|
|
||||||
|
Caution: using conda and virtualenvwrapper at the same time may cause conflicts.
|
||||||
|
|
||||||
Local Python Installation
|
Local Python Installation
|
||||||
-------------------------
|
-------------------------
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#
|
#
|
||||||
# Authors:
|
# Authors:
|
||||||
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
||||||
|
# Patrick Bos <egpbos@gmail.com>
|
||||||
#
|
#
|
||||||
|
|
||||||
# function python-info {
|
# function python-info {
|
||||||
|
@ -22,4 +23,10 @@ if [[ -n "$VIRTUAL_ENV" ]]; then
|
||||||
python_info[virtualenv]="$virtualenv_formatted"
|
python_info[virtualenv]="$virtualenv_formatted"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Do the same for Conda virtual environments
|
||||||
|
if [[ -n "$CONDA_DEFAULT_ENV" ]]; then
|
||||||
|
zstyle -s ':prezto:module:python:info:virtualenv' format 'virtualenv_format'
|
||||||
|
zformat -f virtualenv_formatted "$virtualenv_format" "v:${CONDA_DEFAULT_ENV:t}"
|
||||||
|
python_info[virtualenv]="$virtualenv_formatted"
|
||||||
|
fi
|
||||||
# }
|
# }
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
# Authors:
|
# Authors:
|
||||||
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
||||||
# Sebastian Wiesner <lunaryorn@googlemail.com>
|
# Sebastian Wiesner <lunaryorn@googlemail.com>
|
||||||
|
# Patrick Bos <egpbos@gmail.com>
|
||||||
#
|
#
|
||||||
|
|
||||||
# Load manually installed pyenv into the shell session.
|
# Load manually installed pyenv into the shell session.
|
||||||
|
@ -125,6 +126,19 @@ if (( $+VIRTUALENVWRAPPER_VIRTUALENV || $+commands[virtualenv] )) && \
|
||||||
unset pyenv_plugins
|
unset pyenv_plugins
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Load conda into the shell session, if requested
|
||||||
|
zstyle -T ':prezto:module:python' conda-init
|
||||||
|
if (( $? && $+commands[conda] )); then
|
||||||
|
if (( $(conda ..changeps1) )); then
|
||||||
|
echo "To make sure Conda doesn't change your prompt (should do that in the prompt module) run:\n conda config --set changeps1 false"
|
||||||
|
# TODO:
|
||||||
|
# We could just run this ourselves. In an exit hook
|
||||||
|
# (add zsh-hook zshexit [(anonymous) function]) we could then set it back
|
||||||
|
# to the way it was before we changed it. However, I'm not sure if this is
|
||||||
|
# exception safe, so left it like this for now.
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
# Load PIP completion.
|
# Load PIP completion.
|
||||||
if (( $#commands[(i)pip(|[23])] )); then
|
if (( $#commands[(i)pip(|[23])] )); then
|
||||||
cache_file="${0:h}/cache.zsh"
|
cache_file="${0:h}/cache.zsh"
|
||||||
|
|
Loading…
Add table
Reference in a new issue