Pipenv provides incorrect completion if current shell does not match login shell
See original GitHub issueIt seems as though Pipenv does not correctly detect the fish shell when determining what to output for pipenv --completion
. This is a regression that appeared within the last couple of weeks for me.
$ python -m pipenv.help output
Pipenv version: '11.8.0'
Pipenv location: '/home/qasim/.local/lib/python3.6/site-packages/pipenv'
Python location: '/usr/bin/python'
Other Python installations in PATH
:
-
2.7
:/usr/bin/python2.7
-
2.7
:/usr/bin/python2.7
-
3.6
:/usr/bin/python3.6m
-
3.6
:/usr/bin/python3.6
-
3.6.4
:/usr/bin/python
-
2.7.14
:/usr/bin/python2
-
3.6.4
:/usr/bin/python3
PEP 508 Information:
{'implementation_name': 'cpython',
'implementation_version': '3.6.4',
'os_name': 'posix',
'platform_machine': 'x86_64',
'platform_python_implementation': 'CPython',
'platform_release': '4.15.9-1-ARCH',
'platform_system': 'Linux',
'platform_version': '#1 SMP PREEMPT Sun Mar 11 17:54:33 UTC 2018',
'python_full_version': '3.6.4',
'python_version': '3.6',
'sys_platform': 'linux'}
System environment variables:
COLORTERM
DBUS_SESSION_BUS_ADDRESS
DESKTOP_AUTOSTART_ID
DESKTOP_SESSION
DISPLAY
GDMSESSION
GDM_LANG
GNOME_DESKTOP_SESSION_ID
HOME
LANG
LOGNAME
MAIL
MOZ_PLUGIN_PATH
PATH
PWD
SESSION_MANAGER
SHELL
SHLVL
SSH_AUTH_SOCK
TERM
USER
USERNAME
VTE_VERSION
WINDOWID
WINDOWPATH
XAUTHORITY
XDG_CURRENT_DESKTOP
XDG_MENU_PREFIX
XDG_RUNTIME_DIR
XDG_SEAT
XDG_SESSION_DESKTOP
XDG_SESSION_ID
XDG_SESSION_TYPE
XDG_VTNR
PIP_PYTHON_PATH
PYTHONUNBUFFERED
Pipenv–specific environment variables:
Debug–specific environment variables:
PATH
:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/home/qasim/.local/bin
SHELL
:/bin/bash
LANG
:en_GB.UTF-8
PWD
:/home/qasim
Expected result
I’d expect the completion to complete without errors 😃
Actual result
When attempting to auto-complete on the first Pipenv command:
qasim@qasim-desktop ~> pipenv - (line 1): Illegal command name “_pipenv_completion()”
begin; _pipenv_completion() { local IFS=$'\t' COMPREPLY=( $( env COMP_WORDS="${COMP_WORDS[*]}" \ COMP_CWORD=$COMP_CWORD \ _PIPENV_COMPLETE=complete-bash $1 ) ) return 0 } complete -F _pipenv_completion -o default pipenv
^
from sourcing file -
called on line 60 of file /usr/share/fish/functions/eval.fish
in function “eval”
called on line 1 of file ~/.config/fish/completions/pipenv.fish
from sourcing file ~/.config/fish/completions/pipenv.fish
called on standard input
in command substitution
called on standard input
source: Error while reading file “-”
It seems as though this is the bash code being output from <???> rather than the fish code.
Steps to replicate
pip install --user --upgrade pipenv
- Setup fish completions inside
~/.config/fish/completions/pipenv.fish
:eval (pipenv --completion)
- Enter fish and type
Pipenv
and then try to auto-complete something
Issue Analytics
- State:
- Created 6 years ago
- Reactions:3
- Comments:35 (22 by maintainers)
Top GitHub Comments
Thanks for the offer @anowlcalledjosh — our current stance is that we aren’t using psutil in pipenv. We literally just removed it and had to vendor pew and write c extension bindings for windows. PSUtil is slow and it breaks regularly for windows users, we just aren’t going to use it. We handle enough special edge cases, if we can’t trust your environment we aren’t really able to be responsible for maintaining logic to handle edge cases.
If there’s an approach that works around this, I would be ok with that. But in my mind the easiest approach is to set your shell variable
Proof of concept:
Obviously, doesn’t work in scenarios where there’s an intermediate parent.