diff --git a/functions/python.zsh b/functions/python.zsh index 13c2e94..0015ed2 100644 --- a/functions/python.zsh +++ b/functions/python.zsh @@ -32,9 +32,16 @@ mkvenv(){ 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" - return 1 + + if (( ${+commands[uv]} )); then + 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 if [[ -z ${source_venv} ]]; then