1
0
mirror of https://git.decapod.one/brethil/dotfiles synced 2025-01-06 22:16:03 +01:00

zsh: functions: add uv support in mkvenv

This commit is contained in:
bretello 2024-12-25 20:59:30 +01:00
parent 5dc6cf06f4
commit da0a64ccbd
Signed by: brethil
GPG Key ID: 876AAC6290170FE7

View File

@ -32,9 +32,16 @@ mkvenv(){
info "Creating virtualenv ${venv_name}... " info "Creating virtualenv ${venv_name}... "
if ! python -m virtualenv $@ ${venv_name} ; then
error "Failed to create virtualenv. Is virtualenv installed? Try:\n $ pip install virtualenv" if (( ${+commands[uv]} )); then
return 1 info "Creating venv using uv"
uv venv $@ ${venv_name}
else
warning "uv is not available, falling back to virtualenv module"
if ! python -m virtualenv $@ ${venv_name} ; then
warning "virtualenv module is not available, virtualenv creation will be slow. Install uv or virtualenv."
python -m venv $@ ${venv_name}
fi
fi fi
if [[ -z ${source_venv} ]]; then if [[ -z ${source_venv} ]]; then