Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bash Completion Broken after 2021.11.5 #4872

Closed
jplindquist opened this issue Nov 17, 2021 · 3 comments
Closed

Bash Completion Broken after 2021.11.5 #4872

jplindquist opened this issue Nov 17, 2021 · 3 comments
Labels
Type: Question ❔ This is a question or a request for support.

Comments

@jplindquist
Copy link

jplindquist commented Nov 17, 2021

Be sure to check the existing issues (both open and closed!), and make sure you are running the latest version of Pipenv.

Check the diagnose documentation for common issues before posting! We may close your issue if it is very similar to one of them. Please be considerate, or be on your way.

Make sure to mention your debugging experience if the documented solution failed.

Issue description

Bash completion no longer works on default Bash shell available on MacOS Big Sur (11.6) after upgrading to latest, Also affects current version of CentOS 7

Expected result

Bash completion is properly loaded into the environment

Actual result

A Runtime Error occurs

Steps to replicate

eval "$(_PIPENV_COMPLETE=bash_source pipenv)"

Traceback (most recent call last):
  File "/usr/local/Cellar/pipenv/2021.11.15/libexec/bin/pipenv", line 8, in <module>
    sys.exit(cli())
  File "/usr/local/Cellar/pipenv/2021.11.15/libexec/lib/python3.10/site-packages/pipenv/vendor/click/core.py", line 1128, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/Cellar/pipenv/2021.11.15/libexec/lib/python3.10/site-packages/pipenv/vendor/click/core.py", line 1048, in main
    self._main_shell_completion(extra, prog_name, complete_var)
  File "/usr/local/Cellar/pipenv/2021.11.15/libexec/lib/python3.10/site-packages/pipenv/vendor/click/core.py", line 1123, in _main_shell_completion
    rv = shell_complete(self, ctx_args, prog_name, complete_var, instruction)
  File "/usr/local/Cellar/pipenv/2021.11.15/libexec/lib/python3.10/site-packages/pipenv/vendor/click/shell_completion.py", line 45, in shell_complete
    echo(comp.source())
  File "/usr/local/Cellar/pipenv/2021.11.15/libexec/lib/python3.10/site-packages/pipenv/vendor/click/shell_completion.py", line 326, in source
    self._check_version()
  File "/usr/local/Cellar/pipenv/2021.11.15/libexec/lib/python3.10/site-packages/pipenv/vendor/click/shell_completion.py", line 314, in _check_version
    raise RuntimeError(
RuntimeError: Shell completion is not supported for Bash versions older than 4.4.

Downgraded pipenv via Homebrew to previous version (2021.11.9) and confirmed issue was still present. Downgraded further (2021.11.5 via pip / 2021.5.29 via Homebrewc) to restore bash completion functionality

pip3 install pipenv==2021.11.5
eval "$(pipenv --completion)"

OR

brew tap-new $USER/local-pipenv
brew extract --version=2021.5.29 pipenv $USER/local-pipenv
brew install pipenv@2021.5.29
brew link --overwrite pipenv@2021.5.29

MacOS Big Sur Bash Version

bash --version
GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin20)
Copyright (C) 2007 Free Software Foundation, Inc.

CentOS 7 Versions

pipenv, version 2021.11.15

uname -r
3.10.0-1160.45.1.el7.x86_64

eval "$(_PIPENV_COMPLETE=bash_source pipenv)"
Traceback (most recent call last):
  File "/home/jlindquist/.local/bin/pipenv", line 11, in <module>
    sys.exit(cli())
  File "/home/jlindquist/.local/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 1128, in __call__
    return self.main(*args, **kwargs)
  File "/home/jlindquist/.local/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 1048, in main
    self._main_shell_completion(extra, prog_name, complete_var)
  File "/home/jlindquist/.local/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 1123, in _main_shell_completion
    rv = shell_complete(self, ctx_args, prog_name, complete_var, instruction)
  File "/home/jlindquist/.local/lib/python3.6/site-packages/pipenv/vendor/click/shell_completion.py", line 45, in shell_complete
    echo(comp.source())
  File "/home/jlindquist/.local/lib/python3.6/site-packages/pipenv/vendor/click/shell_completion.py", line 326, in source
    self._check_version()
  File "/home/jlindquist/.local/lib/python3.6/site-packages/pipenv/vendor/click/shell_completion.py", line 316, in _check_version
    "Shell completion is not supported for Bash"
RuntimeError: Shell completion is not supported for Bash versions older than 4.4.

bash --version
GNU bash, version 4.2.46(2)-release (x86_64-redhat-linux-gnu)
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

$ pipenv --support

Pipenv version: '2021.11.15'

Pipenv location: '/usr/local/Cellar/pipenv/2021.11.15/libexec/lib/python3.10/site-packages/pipenv'

Python location: '/usr/local/Cellar/pipenv/2021.11.15/libexec/bin/python3.10'

Python installations found:

  • 3.9.8: /usr/local/bin/python3
  • 3.9.8: /usr/local/bin/python3.9
  • 3.9.4: /Users/jlindquist/.pyenv/versions/3.9.4/bin/python3
  • 3.8.9: /Users/jlindquist/.pyenv/versions/3.8.9/bin/python3
  • 3.8.2: /usr/bin/python3
  • 3.7.10: /Users/jlindquist/.pyenv/versions/3.7.10/bin/python3
  • 3.6.13: /Users/jlindquist/.pyenv/versions/3.6.13/bin/python3
  • 2.7.18: /Users/jlindquist/.pyenv/versions/2.7.18/bin/python
  • 2.7.16: /usr/bin/python
  • 2.7.16: /usr/bin/python2
  • 2.7.16: /usr/bin/python2.7

PEP 508 Information:

{'implementation_name': 'cpython',
 'implementation_version': '3.10.0',
 'os_name': 'posix',
 'platform_machine': 'x86_64',
 'platform_python_implementation': 'CPython',
 'platform_release': '20.6.0',
 'platform_system': 'Darwin',
 'platform_version': 'Darwin Kernel Version 20.6.0: Mon Aug 30 06:12:21 PDT '
                     '2021; root:xnu-7195.141.6~3/RELEASE_X86_64',
 'python_full_version': '3.10.0',
 'python_version': '3.10',
 'sys_platform': 'darwin'}

System environment variables:

  • PATH
  • NVM_INC
  • STARSHIP_SHELL
  • TERM_PROGRAM
  • rvm_bin_path
  • GEM_HOME
  • NVM_CD_FLAGS
  • PYENV_ROOT
  • TERM
  • SHELL
  • PIPENV_VERBOSITY
  • TMPDIR
  • IRBRC
  • PIPENV_VENV_IN_PROJECT
  • TERM_PROGRAM_VERSION
  • TERM_SESSION_ID
  • MY_RUBY_HOME
  • MONO_CFG_DIR
  • USER
  • rvm_stored_umask
  • NVM_DIR
  • COMMAND_MODE
  • MONO_DISABLE_SHARED_AREA
  • rvm_path
  • SSH_AUTH_SOCK
  • MONO_CRASH_NOFILE
  • __CF_USER_TEXT_ENCODING
  • PYENV_VIRTUALENV_DISABLE_PROMPT
  • BASH_SILENCE_DEPRECATION_WARNING
  • FZF_DEFAULT_OPTS
  • rvm_prefix
  • _
  • __LLVM_PROFILE_RT_INIT_ONCE
  • LaunchInstanceID
  • __CFBundleIdentifier
  • rvm_loaded_flag
  • AWS_DEFAULT_REGION
  • PWD
  • MONO_THREADS_SUSPEND
  • EDITOR
  • LANG
  • ITERM_PROFILE
  • XPC_FLAGS
  • XPC_SERVICE_NAME
  • HISTCONTROL
  • rvm_version
  • SHLVL
  • MONO_REGISTRY_PATH
  • COLORFGBG
  • HOME
  • PYENV_SHELL
  • POETRY_VIRTUALENVS_IN_PROJECT
  • ITERM_SESSION_ID
  • LOGNAME
  • STARSHIP_SESSION_KEY
  • GEM_PATH
  • NVM_BIN
  • PROMPT_COMMAND
  • MONO_XMLSERIALIZER_THS
  • SECURITYSESSIONID
  • SQLITE_EXEMPT_PATH_FROM_VNODE_GUARDS
  • RUBY_VERSION
  • rvm_user_install_flag
  • COLORTERM
  • PIP_SHIMS_BASE_MODULE
  • PIP_DISABLE_PIP_VERSION_CHECK
  • PYTHONDONTWRITEBYTECODE
  • PIP_PYTHON_PATH
  • PYTHONFINDER_IGNORE_UNSUPPORTED

Pipenv–specific environment variables:

  • PIPENV_VERBOSITY: -1
  • PIPENV_VENV_IN_PROJECT: true

Debug–specific environment variables:

  • PATH: /usr/local/Cellar/pipenv/2021.11.15/libexec/tools:/usr/local/opt/openssl@1.1/bin:/Users/jlindquist/.local/bin:/Users/jlindquist/.pyenv/bin:/Users/jlindquist/.nvm/versions/node/v16.2.0/bin:/Users/jlindquist/.rvm/gems/ruby-2.6.5/bin:/Users/jlindquist/.rvm/gems/ruby-2.6.5@global/bin:/Users/jlindquist/.rvm/rubies/ruby-2.6.5/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/go/bin:/opt/puppetlabs/pdk/bin:/opt/puppetlabs/bin:/Applications/Wireshark.app/Contents/MacOS:/Users/jlindquist/.rvm/bin
  • SHELL: /bin/bash
  • EDITOR: atom-beta -nw
  • LANG: en_US.UTF-8
  • PWD: /Users/jlindquist

@jplindquist jplindquist changed the title Bash Completion Broken on MacOs Bash Completion Broken after 2021.11.5 Nov 17, 2021
@matteius
Copy link
Member

@jplindquist it says in your output that the vendor package click for shell completion is requiring Bash versions 4.4 or newer, and you are showing a bash version of 3.2.57 in mac os and 4.2.46 on redhat linux.

RuntimeError: Shell completion is not supported for Bash versions older than 4.4.
GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin20)
GNU bash, version 4.2.46(2)-release (x86_64-redhat-linux-gnu)

I think this not a case of it being broken, but a case of it being unsupported. Can you upgrade your bash shell?

@matteius matteius added the Type: Question ❔ This is a question or a request for support. label Dec 24, 2021
@jplindquist
Copy link
Author

I can update my shell, but I'm surprised it doesn't support the default Bash shell that ships with both MacOS Big Sur (11.6.2) and CentOS 7 which are still well within their lifecycle of support.

@matteius
Copy link
Member

matteius commented Jan 9, 2022

@jplindquist Yeah sorry, but it seems that click being vendor code, was updated in 8.0.0 to only support bash >= 4.4.0 -- it is in their release notes: https://click.palletsprojects.com/en/8.0.x/changes/#version-8-0-0

In order to gain bug fixes and thing that are related to downstream vendor packages, we have to update vendor code from time to time, which is why this became a requirement after 2021.11.5 which looking at the release notes appears is because of "Replace click-completion with click’s own completion implementation." #4786 See: https://pipenv.pypa.io/en/latest/changelog/#id19

Since version 8, click itself provides shell completion support that is actually superior to that provided by click-completion.

I am going to close this as I don't think anything can be done except use to upgrade bash version, or use the version that worked prior with current bash, or live with the issue of not having auto complete in the shell work properly, sorry!

@matteius matteius closed this as completed Jan 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Question ❔ This is a question or a request for support.
Projects
None yet
Development

No branches or pull requests

2 participants