Open ttecles opened 2 years ago
@ttecles I am having trouble finding any reference to a --completion flag in the code base. Can you reference me to the docs where it is specified?
@ttecles I am having trouble finding any reference to a --completion flag in the code base. Can you reference me to the docs where it is specified?
@matteius there you go: https://pipenv-fork.readthedocs.io/en/latest/advanced.html#shell-completion
I found a commit that removed that flag: https://github.com/pypa/pipenv/commit/267ba191a5cb0623bc99e60b44e99045a11e07cd
@ttecles I am having trouble finding any reference to a --completion flag in the code base. Can you reference me to the docs where it is specified?
@matteius there you go: https://pipenv-fork.readthedocs.io/en/latest/advanced.html#shell-completion
I found a commit that removed that flag: 267ba19
I see the docs in github do not have that anymore: https://github.com/pypa/pipenv/blob/main/docs/advanced.rst#-shell-completion
@ttecles Thanks, and just noting that the correct page to access the pipenv docs is here: https://pipenv.pypa.io/en/latest/
@ttecles Thanks, and just noting that the correct page to access the pipenv docs is here: https://pipenv.pypa.io/en/latest/
thanks @matteius
@ttecles you probably did the same as me - upgrade pipenv and notice your shell completion broke. It looks like this breaking change was released in 2021.11.9, and the changelog doesn't say anything about it directly. I had to create a version check in my .profile
to determine how to install pipenv completion, like so:
# Set up magic shell completion for pipenv (works in bash and zsh)
# Have to check version bc pipenv changed the implementation
if version_greater_equal "$(pipenv --version)" "2021.11.9" ; then
eval "$(_PIPENV_COMPLETE=zsh_source pipenv)"
else
eval "$(pipenv --completion)"
fi
It would have been nice if this sort of thing had been updated in the docs along with this sort of breaking change. I'm also now going to have to make it shell-specific in my .profile...
EDIT: Now it looks like this:
# Set up magic shell completion for pipenv (works in bash and zsh)-
# Have to check version bc pipenv changed the implementation
if version_greater_equal "$(pipenv --version)" "2021.11.9" ; then
RUNNING_SHELL="$(ps -p$$ -ocmd=)"--
case $RUNNING_SHELL in
-zsh) eval "$(_PIPENV_COMPLETE=zsh_source pipenv)";;
-bash) eval "$(_PIPENV_COMPLETE=bash_source pipenv)";;
*) echo "SHELL $RUNNING_SHELL not supported for pipenv completions!"
esac
else
# used to work this way for all shells
eval "$(pipenv --completion)";;
fi
I added some tags to the ticket since it seems like there is a chance to improve something here. I don't have the bandwidth to directly make changes at the moment, but I could advise and review PR if there were an improvement to be made. My thoughts are we are trying to reduce the number of flags supported in some cases, where it makes sense. I am speculating that the change away from --completion is that shell completion is supposed to work by default, so passing a flag to enable it seems like we want to move away from that.
TLDR: Enhancement potential here if we can make it work nicer -- I didn't experience the issue directly, but also let's not add back --completion flag, let's try to make it work well out of the box.
I think this can be closed. The last maintainer had dropped the --completion
flag and we don't intend to add it back. We also recently fixed a different bug around completion being broken.
I am speculating that the change away from --completion is that shell completion is supposed to work by default, so passing a flag to enable it seems like we want to move away from that.
Reducing the number of flags is a very admirable goal, but unless a completion script has been sourced by bash, I'm curious how this is supposed to work by default.
(note, also came here since my shell suddenly started shooting out this error—think a deprecation plan should have been considered in this case)
@dlo - The flag as removed before I started working on the project; we have no plans to add it back in to add a deprecation warning and then removing it again.
unless a completion script has been sourced by bash, I'm curious how this is supposed to work by default.
Edited: I was reopening the issue and had a half typed out comment and it posted that. I am not sure -- this was before I started and I haven't used auto completion -- I just tried it and not sure if it fully works, I can have it recommend the first commands but say I type pipenv install
+ tab there are no recommendations. Should there be? Either way it sounds like more thought needs to go into how to move this issue forward.
I just found this and for completeness, version_greater_equal
is
referenced here: https://unix.stackexchange.com/a/567537
# Set up magic shell completion for pipenv (works in bash and zsh) # Have to check version bc pipenv changed the implementation if version_greater_equal "$(pipenv --version)" "2021.11.9" ; then eval "$(_PIPENV_COMPLETE=zsh_source pipenv)" else eval "$(pipenv --completion)" fi
@Guang1234567 The link is broken.
The
pipenv --completion
command is not working:$ pipenv --support
Pipenv version: `'2022.1.8'` Pipenv location: `'/home/joan/.local/lib/python3.8/site-packages/pipenv'` Python location: `'/usr/bin/python'` Python installations found: - `3.10.0`: `/home/joan/.pyenv/versions/3.10.0/bin/python3` - `3.8.10`: `/home/joan/.pyenv/versions/list/bin/python3` - `3.8.10`: `/home/joan/.pyenv/versions/PoC/bin/python3` - `3.8.10`: `/usr/bin/python3.8` - `3.8.10`: `/usr/bin/python3` - `3.8.10`: `/usr/bin/python` - `3.8.10`: `/bin/python3.8` - `3.8.10`: `/bin/python3` - `3.8.10`: `/bin/python` - `3.7.7`: `/home/joan/.pyenv/versions/3.7.7/bin/python3.7` - `3.7.6`: `/home/joan/.pyenv/versions/3.7.6/bin/python3.7` - `3.7.5`: `/home/joan/.pyenv/versions/3.7.5/bin/python3.7` - `3.7.0`: `/home/joan/.pyenv/versions/3.7.0/bin/python3.7` - `3.6.15`: `/home/joan/.pyenv/versions/product-brewer/bin/python3.6` - `3.6.15`: `/home/joan/.pyenv/versions/3.6.15/bin/python3.6m` - `3.6.15`: `/home/joan/.pyenv/versions/WardrobeClient/bin/python3.6` - `3.6.10`: `/home/joan/.pyenv/versions/3.6.10/bin/python3.6m` - `3.6.7`: `/home/joan/.pyenv/versions/3.6.7/bin/python3.6m` - `2.7.18`: `/home/joan/.pyenv/versions/2.7.18/bin/python2` PEP 508 Information: ``` {'implementation_name': 'cpython', 'implementation_version': '3.8.10', 'os_name': 'posix', 'platform_machine': 'x86_64', 'platform_python_implementation': 'CPython', 'platform_release': '5.14.0-1027-oem', 'platform_system': 'Linux', 'platform_version': '#30-Ubuntu SMP Mon Mar 7 15:00:29 UTC 2022', 'python_full_version': '3.8.10', 'python_version': '3.8', 'sys_platform': 'linux'} ``` System environment variables: - `SHELL` - `PIPENV_PYPI_MIRROR` - `SESSION_MANAGER` - `QT_ACCESSIBILITY` - `COLORTERM` - `XDG_CONFIG_DIRS` - `NVM_INC` - `XDG_MENU_PREFIX` - `GNOME_DESKTOP_SESSION_ID` - `LC_ADDRESS` - `GNOME_SHELL_SESSION_MODE` - `LC_NAME` - `SSH_AUTH_SOCK` - `ANDROID_SDK` - `XMODIFIERS` - `DESKTOP_SESSION` - `LC_MONETARY` - `SSH_AGENT_PID` - `GTK_MODULES` - `PWD` - `PYENV_VIRTUALENV_INIT` - `LOGNAME` - `XDG_SESSION_DESKTOP` - `XDG_SESSION_TYPE` - `GPG_AGENT_INFO` - `XAUTHORITY` - `WINDOWPATH` - `HOME` - `USERNAME` - `IM_CONFIG_PHASE` - `LC_PAPER` - `LANG` - `LS_COLORS` - `XDG_CURRENT_DESKTOP` - `VTE_VERSION` - `GNOME_TERMINAL_SCREEN` - `INVOCATION_ID` - `MANAGERPID` - `NVM_DIR` - `LESSCLOSE` - `XDG_SESSION_CLASS` - `TERM` - `LC_IDENTIFICATION` - `LESSOPEN` - `LIBVIRT_DEFAULT_URI` - `USER` - `GNOME_TERMINAL_SERVICE` - `DISPLAY` - `SHLVL` - `NVM_CD_FLAGS` - `LC_TELEPHONE` - `QT_IM_MODULE` - `LC_MEASUREMENT` - `XDG_RUNTIME_DIR` - `PS1` - `LC_TIME` - `JOURNAL_STREAM` - `XDG_DATA_DIRS` - `PATH` - `GDMSESSION` - `DBUS_SESSION_BUS_ADDRESS` - `NVM_BIN` - `LC_NUMERIC` - `OLDPWD` - `_` - `PIP_SHIMS_BASE_MODULE` - `PIP_DISABLE_PIP_VERSION_CHECK` - `PYTHONDONTWRITEBYTECODE` - `PIP_PYTHON_PATH` - `PYTHONFINDER_IGNORE_UNSUPPORTED` Pipenv–specific environment variables: - `PIPENV_PYPI_MIRROR`: `http://pypi.edtd.net/EDITED/dev/+simple/` Debug–specific environment variables: - `PATH`: `/home/joan/.nvm/versions/node/v10.7.0/bin:/home/joan/.poetry/bin:/home/joan/.pyenv/plugins/pyenv-virtualenv/shims:/home/joan/.pyenv/shims:/home/joan/.pyenv/bin:/home/joan/.poetry/bin:/home/joan/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/joan/.fzf/bin:/opt/apache-storm/bin` - `SHELL`: `/bin/bash` - `LANG`: `en_US.UTF-8` - `PWD`: `/home/joan/apps/hydra` ---------------------------and here is my env: