From 65681fd8f1c0f93e27f7399e33c2d21572815e7f Mon Sep 17 00:00:00 2001 From: Matheus Felipe Date: Sun, 12 Apr 2026 04:27:42 -0300 Subject: [PATCH 1/2] fix(pipenv): add argcomplete compatibility for >= 2026.5.0 --- plugins/pipenv/README.md | 2 +- plugins/pipenv/pipenv.plugin.zsh | 35 ++++++++++++++++++++++++-------- 2 files changed, 28 insertions(+), 9 deletions(-) diff --git a/plugins/pipenv/README.md b/plugins/pipenv/README.md index 429b6f186..3c41d0240 100644 --- a/plugins/pipenv/README.md +++ b/plugins/pipenv/README.md @@ -10,7 +10,7 @@ plugins=(... pipenv ...) ## Features -- Adds completion for pipenv +- Adds completion for pipenv ([install the `argcomplete` package to get it working with pipenv >= 2026.5.0](https://pipenv.pypa.io/en/latest/shell.html#shell-completion)) - Auto activates and deactivates pipenv shell - Adds short aliases for common pipenv commands - `pch` is aliased to `pipenv check` diff --git a/plugins/pipenv/pipenv.plugin.zsh b/plugins/pipenv/pipenv.plugin.zsh index 76d66b301..2836212da 100644 --- a/plugins/pipenv/pipenv.plugin.zsh +++ b/plugins/pipenv/pipenv.plugin.zsh @@ -2,15 +2,33 @@ if (( ! $+commands[pipenv] )); then return fi -# If the completion file doesn't exist yet, we need to autoload it and -# bind it to `pipenv`. Otherwise, compinit will have already done that. -if [[ ! -f "$ZSH_CACHE_DIR/completions/_pipenv" ]]; then - typeset -g -A _comps - autoload -Uz _pipenv - _comps[pipenv]=_pipenv -fi +# Compatibility note: +# pipenv < 2026.5.0 used Click-based shell completion driven by the +# _PIPENV_COMPLETE environment variable. +# +# pipenv >= 2026.5.0 removed this mechanism and switched to argcomplete-based +# completion using register-python-argcomplete instead. -_PIPENV_COMPLETE=zsh_source pipenv >| "$ZSH_CACHE_DIR/completions/_pipenv" &| +if (( $+commands[register-python-argcomplete] )); then + # pipenv >= 2026.5.0 (argcomplete-based completion) + autoload -U bashcompinit + bashcompinit + + eval "$(register-python-argcomplete pipenv)" + +else + # pipenv < 2026.5.0 (legacy Click-based completion via _PIPENV_COMPLETE) + + # If the completion file doesn't exist yet, we need to autoload it and + # bind it to `pipenv`. Otherwise, compinit will have already done that. + if [[ ! -f "$ZSH_CACHE_DIR/completions/_pipenv" ]]; then + typeset -g -A _comps + autoload -Uz _pipenv + _comps[pipenv]=_pipenv + fi + + _PIPENV_COMPLETE=zsh_source pipenv >| "$ZSH_CACHE_DIR/completions/_pipenv" &| +fi if zstyle -T ':omz:plugins:pipenv' auto-shell; then # Automatic pipenv shell activation/deactivation @@ -34,6 +52,7 @@ if zstyle -T ':omz:plugins:pipenv' auto-shell; then fi fi } + autoload -U add-zsh-hook add-zsh-hook chpwd _togglePipenvShell _togglePipenvShell From 9a150a71c2803accd17f63f9df307aed6fad867e Mon Sep 17 00:00:00 2001 From: Matheus Felipe Date: Mon, 18 May 2026 15:29:14 -0300 Subject: [PATCH 2/2] fix(pipenv): add argcomplete compatibility for >= 2026.5.0 and keep legacy completion --- plugins/pipenv/pipenv.plugin.zsh | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/plugins/pipenv/pipenv.plugin.zsh b/plugins/pipenv/pipenv.plugin.zsh index 2836212da..0279b1286 100644 --- a/plugins/pipenv/pipenv.plugin.zsh +++ b/plugins/pipenv/pipenv.plugin.zsh @@ -9,15 +9,19 @@ fi # pipenv >= 2026.5.0 removed this mechanism and switched to argcomplete-based # completion using register-python-argcomplete instead. -if (( $+commands[register-python-argcomplete] )); then - # pipenv >= 2026.5.0 (argcomplete-based completion) - autoload -U bashcompinit +autoload -Uz is-at-least + +_pipenv_version="${$(pipenv --version 2>/dev/null)#pipenv, version }" + +if is-at-least 2026.5.0 "$_pipenv_version" && (( $+commands[register-python-argcomplete] )); then + # argcomplete-based completion + autoload -Uz bashcompinit bashcompinit eval "$(register-python-argcomplete pipenv)" else - # pipenv < 2026.5.0 (legacy Click-based completion via _PIPENV_COMPLETE) + # legacy Click-based completion via _PIPENV_COMPLETE # If the completion file doesn't exist yet, we need to autoload it and # bind it to `pipenv`. Otherwise, compinit will have already done that.