pypa / pipenv

Python Development Workflow for Humans.
https://pipenv.pypa.io
MIT License
24.83k stars 1.87k forks source link

Unexpected behaviour when `PIPENV_VERSION` environment variable is set #5627

Open micuda opened 1 year ago

micuda commented 1 year ago

Is your feature request related to a problem? Please describe.

Having the PIPENV_VERSION environment variable set leads to the unexpected behaviour.

I encountered this problem during setting up the CI configuration. I have parametrized Python version by environment variable and I wanted to do the same for pipenv.

Describe the solution you'd like

The only use case I can think of for this feature might be to "disable" the current pipenv command, e.g.

PIPENV_VERSION=true pipenv run mypy .

will print the pipenv version instead of running the mypy.

I would propose to do not treat this environment variable as the configurational one.

Describe alternatives you've considered

In case the pipenv would like to keep this feature, I would propose to add a mention about PIPENV_VERSION environment variable to the Configuration With Environment Variables section of the documentation.

And maybe would be nice (more user friendly) to put link that refers to Configuration With Environment Variables to the error message, so instead of:

> PIPENV_VERSION=2022.7.24 pipenv
Usage: pipenv [OPTIONS] COMMAND [ARGS]...
Try 'pipenv -h' for help.

Error: Invalid value for '--version': '2022.7.24' is not a valid boolean.

display somethink like

> PIPENV_VERSION=2022.7.24 pipenv
Usage: pipenv [OPTIONS] COMMAND [ARGS]...
Try 'pipenv -h' for help.

Error: Invalid value for '--version': '2022.7.24' is not a valid boolean.
For more information about configuring `pipenv` via environment variables see https://pipenv.pypa.io/en/latest/advanced/#configuration-with-environment-variables.

Additional context

I have found one related issue to this - the https://github.com/pypa/pipenv/issues/3633. It was created on 20.3.2019, closed on 30.3.2019 and the last mention of it is from 5.9.2022, so people are still encountering the problem.

$ pipenv --support Pipenv version: `'2022.7.24'` Pipenv location: `'/home/jcas/.pyenv/versions/3.8.10/envs/ds-upsell3.8.10/lib/python3.8/site-packages/pipenv'` Python location: `'/home/jcas/.pyenv/versions/3.8.10/envs/ds-upsell3.8.10/bin/python3.8'` Python installations found: - `3.11.2`: `/home/jcas/.pyenv/versions/3.11.2/bin/python3` - `3.10.9`: `/home/jcas/.pyenv/versions/3.10.9/bin/python3` - `3.10.6`: `/home/jcas/.pyenv/versions/3.10.6/bin/python3` - `3.10.4`: `/home/jcas/.pyenv/versions/3.10.4/bin/python3` - `3.10.2`: `/home/jcas/.pyenv/versions/3.10.2/bin/python3` - `3.9.10`: `/home/jcas/.pyenv/versions/3.9.10/bin/python3` - `3.9.6`: `/home/jcas/.pyenv/versions/3.9.6/bin/python3` - `3.8.13`: `/home/jcas/.pyenv/versions/3.8.13/bin/python3` - `3.8.12`: `/home/jcas/.pyenv/versions/3.8.12/bin/python3` - `3.8.10`: `/home/jcas/.pyenv/versions/3.8.10/bin/python3` - `3.8.10`: `/usr/bin/python3` - `3.8.10`: `/usr/bin/python3.8` - `3.8.10`: `/bin/python3` - `3.8.10`: `/bin/python3.8` - `2.7.18`: `/usr/bin/python2` - `2.7.18`: `/usr/bin/python2.7` - `2.7.18`: `/usr/bin/python` - `2.7.18`: `/bin/python2` - `2.7.18`: `/bin/python2.7` - `2.7.18`: `/bin/python` 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.15.0-58-generic', 'platform_system': 'Linux', 'platform_version': '#64~20.04.1-Ubuntu SMP Fri Jan 6 16:42:31 UTC 2023', 'python_full_version': '3.8.10', 'python_version': '3.8', 'sys_platform': 'linux'} ``` System environment variables: - `SHELL` - `SESSION_MANAGER` - `QT_ACCESSIBILITY` - `TMUX_COLUMNS_59` - `COLORTERM` - `TMUX_COLUMNS_58` - `TMUX_COLUMNS_55` - `TMUX_COLUMNS_54` - `TMUX_COLUMNS_57` - `PYENV_SHELL` - `TMUX_COLUMNS_56` - `TMUX_COLUMNS_51` - `TMUX_COLUMNS_50` - `TMUX_COLUMNS_53` - `TMUX_COLUMNS_52` - `XDG_CONFIG_DIRS` - `XDG_SESSION_PATH` - `TMUX_COLUMNS_103` - `TMUX_COLUMNS_102` - `TMUX_COLUMNS_101` - `TMUX_COLUMNS_100` - `TMUX_COLUMNS_107` - `TMUX_COLUMNS_106` - `GNOME_DESKTOP_SESSION_ID` - `TMUX_COLUMNS_105` - `TMUX_COLUMNS_104` - `TMUX_COLUMNS_109` - `TMUX_COLUMNS_108` - `TMUX` - `LANGUAGE` - `MANDATORY_PATH` - `LC_ADDRESS` - `TMUX_PWD_6` - `TMUX_PWD_7` - `TMUX_PWD_4` - `TMUX_PWD_5` - `TMUX_PWD_2` - `TMUX_PWD_3` - `TMUX_PWD_0` - `TMUX_PWD_1` - `LC_NAME` - `SSH_AUTH_SOCK` - `TMUX_PWD_8` - `TMUX_PWD_9` - `TMUX_PWD_47` - `TMUX_PWD_44` - `TMUX_PWD_45` - `TMUX_PWD_42` - `TMUX_PWD_43` - `TMUX_PWD_40` - `TMUX_PWD_41` - `TMUX_PWD_48` - `TMUX_PLUGIN_MANAGER_PATH` - `TMUX_PWD_15` - `TMUX_PWD_14` - `TMUX_PWD_17` - `TMUX_PWD_16` - `RIPGREP_CONFIG_PATH` - `TMUX_PWD_10` - `TMUX_PWD_13` - `TMUX_PWD_12` - `TMUX_PWD_19` - `TMUX_PWD_18` - `DESKTOP_SESSION` - `LC_MONETARY` - `SSH_AGENT_PID` - `TMUX_PWD_109` - `TMUX_PWD_108` - `TMUX_PWD_107` - `TMUX_PWD_106` - `TMUX_PWD_105` - `TMUX_PWD_104` - `TMUX_PWD_103` - `TMUX_PWD_102` - `TMUX_PWD_101` - `TMUX_PWD_100` - `EDITOR` - `GTK_MODULES` - `XDG_SEAT` - `PWD` - `PYENV_VIRTUALENV_INIT` - `XDG_SESSION_DESKTOP` - `LOGNAME` - `QT_QPA_PLATFORMTHEME` - `XDG_SESSION_TYPE` - `TMUX_COLUMNS_28` - `TMUX_COLUMNS_29` - `TMUX_COLUMNS_20` - `TMUX_COLUMNS_21` - `TMUX_COLUMNS_22` - `TMUX_COLUMNS_23` - `TMUX_COLUMNS_24` - `TMUX_COLUMNS_25` - `TMUX_COLUMNS_26` - `TMUX_COLUMNS_27` - `TMUX_PWD_99` - `TMUX_PWD_98` - `TMUX_PWD_95` - `GPG_AGENT_INFO` - `TMUX_PWD_94` - `TMUX_PWD_97` - `TMUX_PWD_91` - `TMUX_PWD_90` - `TMUX_PWD_93` - `TMUX_PWD_92` - `TMUX_COLUMNS_77` - `TMUX_COLUMNS_76` - `TMUX_COLUMNS_75` - `TMUX_COLUMNS_74` - `TMUX_COLUMNS_73` - `TMUX_COLUMNS_72` - `TMUX_COLUMNS_71` - `TMUX_COLUMNS_70` - `TMUX_COLUMNS_79` - `XAUTHORITY` - `FZF_DEFAULT_COMMAND` - `XDG_GREETER_DATA_DIR` - `TMUX_PWD_39` - `TMUX_PWD_38` - `TMUX_PWD_37` - `TMUX_PWD_36` - `TMUX_PWD_35` - `TMUX_PWD_34` - `TMUX_PWD_33` - `TMUX_PWD_32` - `TMUX_PWD_31` - `TMUX_PWD_30` - `TMUX_COLUMNS_99` - `GDM_LANG` - `TMUX_COLUMNS_98` - `TMUX_COLUMNS_91` - `TMUX_COLUMNS_90` - `TMUX_COLUMNS_93` - `TMUX_COLUMNS_92` - `TMUX_COLUMNS_95` - `HOME` - `TMUX_COLUMNS_94` - `TMUX_COLUMNS_97` - `LC_PAPER` - `LANG` - `LS_COLORS` - `XDG_CURRENT_DESKTOP` - `VTE_VERSION` - `TMUX_PWD_60` - `TMUX_PWD_61` - `TMUX_PWD_62` - `TMUX_PWD_63` - `TMUX_PWD_64` - `TMUX_PWD_66` - `TMUX_PWD_67` - `TMUX_PWD_68` - `TMUX_PWD_69` - `TMUX_COLUMNS_10` - `TMUX_COLUMNS_13` - `TMUX_COLUMNS_12` - `TMUX_COLUMNS_15` - `TMUX_COLUMNS_14` - `XDG_SEAT_PATH` - `TMUX_COLUMNS_17` - `TMUX_COLUMNS_16` - `TMUX_COLUMNS_19` - `TMUX_COLUMNS_18` - `GNOME_TERMINAL_SCREEN` - `TMUX_PWD_59` - `TMUX_PWD_58` - `TMUX_PWD_51` - `TMUX_PWD_50` - `TMUX_PWD_53` - `TMUX_PWD_52` - `TMUX_PWD_55` - `TMUX_PWD_54` - `TMUX_PWD_57` - `TMUX_PWD_56` - `NVM_DIR` - `TMUXINATOR_CONFIG` - `LESSCLOSE` - `XDG_SESSION_CLASS` - `TERM` - `LC_IDENTIFICATION` - `FZF_CTRL_T_COMMAND` - `GTK_OVERLAY_SCROLLING` - `DEFAULTS_PATH` - `LESSOPEN` - `TMUX_COLUMNS_39` - `TMUX_COLUMNS_38` - `USER` - `TMUX_COLUMNS_33` - `TMUX_COLUMNS_32` - `TMUX_COLUMNS_31` - `TMUX_COLUMNS_30` - `TMUX_PANE` - `TMUX_COLUMNS_37` - `TMUX_COLUMNS_36` - `TMUX_COLUMNS_35` - `TMUX_COLUMNS_34` - `GNOME_TERMINAL_SERVICE` - `TMUX_COLUMNS_48` - `TMUX_COLUMNS_42` - `TMUX_COLUMNS_43` - `TMUX_COLUMNS_40` - `TMUX_COLUMNS_41` - `TMUX_COLUMNS_47` - `TMUX_COLUMNS_44` - `TMUX_COLUMNS_45` - `DISPLAY` - `SHLVL` - `NVM_CD_FLAGS` - `LC_TELEPHONE` - `LC_MEASUREMENT` - `XDG_VTNR` - `DESKTOP_AUTOSTART_ID` - `XDG_SESSION_ID` - `TMUX_PWD_73` - `TMUX_PWD_72` - `TMUX_PWD_71` - `TMUX_PWD_70` - `TMUX_PWD_77` - `TMUX_PWD_76` - `TMUX_PWD_75` - `TMUX_PWD_74` - `TMUX_PWD_79` - `XDG_RUNTIME_DIR` - `TMUX_COLUMNS_8` - `TMUX_COLUMNS_9` - `TMUX_COLUMNS_2` - `TMUX_COLUMNS_3` - `TMUX_COLUMNS_0` - `TMUX_COLUMNS_1` - `TMUX_COLUMNS_6` - `TMUX_COLUMNS_7` - `TMUX_COLUMNS_4` - `TMUX_COLUMNS_5` - `TMUX_COLUMNS_64` - `TMUX_COLUMNS_66` - `TMUX_COLUMNS_67` - `TMUX_COLUMNS_60` - `PYENV_ROOT` - `TMUX_COLUMNS_61` - `TMUX_COLUMNS_62` - `TMUX_COLUMNS_63` - `TMUX_COLUMNS_68` - `TMUX_COLUMNS_69` - `GTK3_MODULES` - `XDG_DATA_DIRS` - `TMUX_COLUMNS_87` - `TMUX_COLUMNS_84` - `TMUX_COLUMNS_85` - `TMUX_COLUMNS_82` - `TMUX_COLUMNS_83` - `TMUX_COLUMNS_80` - `TMUX_COLUMNS_81` - `PATH` - `TMUX_COLUMNS_88` - `TMUX_COLUMNS_89` - `GDMSESSION` - `DBUS_SESSION_BUS_ADDRESS` - `tmux_version` - `TMUX_PWD_88` - `TMUX_PWD_89` - `TMUX_PWD_82` - `NVM_BIN` - `TMUX_PWD_83` - `TMUX_PWD_80` - `TMUX_PWD_81` - `TMUX_PWD_87` - `TMUX_PWD_84` - `TMUX_PWD_85` - `POWERLINE_COMMAND` - `LC_NUMERIC` - `OLDPWD` - `TMUX_PWD_28` - `TMUX_PWD_29` - `TMUX_PWD_24` - `TMUX_PWD_25` - `TMUX_PWD_26` - `TMUX_PWD_27` - `TMUX_PWD_20` - `TMUX_PWD_21` - `TMUX_PWD_22` - `TMUX_PWD_23` - `_` - `PIP_SHIMS_BASE_MODULE` - `PIP_DISABLE_PIP_VERSION_CHECK` - `PIP_PYTHON_PATH` - `PYTHONDONTWRITEBYTECODE` - `PYTHONFINDER_IGNORE_UNSUPPORTED` Pipenv–specific environment variables: Debug–specific environment variables: - `PATH`: `/home/jcas/.local/bin:/home/jcas/bin:/home/jcas/.poetry/bin:/home/jcas/.pyenv/plugins/pyenv-virtualenv/shims:/home/jcas/.pyenv/shims:/home/jcas/.pyenv/bin:/home/jcas/.local/bin:/home/jcas/.nvm/versions/node/v16.14.0/bin:/home/jcas/.poetry/bin:/home/jcas/.pyenv/plugins/pyenv-virtualenv/shims:/home/jcas/.pyenv/bin:/home/jcas/.local/bin:/home/jcas/.poetry/bin:/home/jcas/.local/bin:/home/jcas/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/jcas/.fzf/bin` - `SHELL`: `/bin/bash` - `EDITOR`: `nvim` - `LANG`: `en_US.UTF-8` - `PWD`: `/home/jcas/` ---------------------------
matteius commented 1 year ago

I just searched the current code base and don't see where we are using a VERSION env var, -- that would get the PIPENV_ prefix if we were, but I don't see it. Also noting your support shows you on `Pipenv version: '2022.7.24'

Could you upgrade to 2023.2.18 and check again?

matteius commented 1 year ago

I would propose to do not treat this environment variable as the configurational one.

I don't see where the environment variables listed there mention a VERSION variable either ...

micuda commented 1 year ago

I just searched the current code base and don't see where we are using a VERSION env var, -- that would get the PIPENV_ prefix if we were, but I don't see it. Also noting your support shows you on `Pipenv version: '2022.7.24'

@matteius, heh, I did exactly the same before. =) As I understand correctly from the #3633, this is feature of click library.

Could you upgrade to 2023.2.18 and check again?

You have good point here. =) I have tried it on the 2023.2.18 version, but the result is the same.

matteius commented 1 year ago

image