pipenv icon indicating copy to clipboard operation
pipenv copied to clipboard

--envs doesn't output environment variable options

Open natgads opened this issue 1 year ago • 4 comments

Issue description

pipenv --envs doesn't list any environment variables. The following change brings the expected behaviour back:

diff --git a/pipenv/cli/command.py b/pipenv/cli/command.py
index ea243683..f6b8695f 100644
--- a/pipenv/cli/command.py
+++ b/pipenv/cli/command.py
@@ -117,7 +117,7 @@ def cli(
             return 1
     if envs:
         echo("The following environment variables can be set, to do various things:\n")
-        for key in state.project.__dict__:
+        for key in state.project.s.__dict__:
             if key.startswith("PIPENV"):
                 echo(f"  - {style(key, bold=True)}")
         echo(

I've checked a few versions and the bug first appears in v2021.11.5 when environment variable handling was reworked.

Expected result

Using the fix above applied to 581f0bf:

The following environment variables can be set, to do various things:

  - PIPENV_CACHE_DIR
  - PIPENV_DEFAULT_PYTHON_VERSION
  - PIPENV_DONT_LOAD_ENV
  - PIPENV_DONT_USE_PYENV
  - PIPENV_DONT_USE_ASDF
  - PIPENV_DOTENV_LOCATION
  - PIPENV_EMULATOR
  - PIPENV_IGNORE_VIRTUALENVS
  - PIPENV_INSTALL_TIMEOUT
  - PIPENV_MAX_DEPTH
  - PIPENV_MAX_RETRIES
  - PIPENV_NO_INHERIT
  - PIPENV_NOSPIN
  - PIPENV_SPINNER
  - PIPENV_PIPFILE
  - PIPENV_PYPI_MIRROR
  - PIPENV_SHELL_EXPLICIT
  - PIPENV_SHELL_FANCY
  - PIPENV_TIMEOUT
  - PIPENV_VENV_IN_PROJECT
  - PIPENV_YES
  - PIPENV_SKIP_LOCK
  - PIPENV_RESOLVE_VCS
  - PIPENV_CUSTOM_VENV_NAME
  - PIPENV_PYUP_API_KEY
  - PIPENV_PYTHON
  - PIPENV_TEST_INDEX
  - PIPENV_USE_SYSTEM
  - PIPENV_VIRTUALENV
  - PIPENV_SKIP_VALIDATION
  - PIPENV_SHELL
  - PIPENV_VERBOSITY

You can learn more at:
   https://pipenv.pypa.io/en/latest/advanced/#configuration-with-environment-variables

Actual result

The following environment variables can be set, to do various things:


You can learn more at:
   https://pipenv.pypa.io/en/latest/advanced/#configuration-with-environment-variables

Steps to replicate

pipenv --envs


$ pipenv --support

Pipenv version: '2022.11.30'

Pipenv location: '/opt/homebrew/lib/python3.10/site-packages/pipenv'

Python location: '/opt/homebrew/opt/[email protected]/bin/python3.10'

OS Name: 'posix'

User pip version: '22.3'

user Python installations found:

  • 3.10.8: /opt/homebrew/bin/python3

PEP 508 Information:

{'implementation_name': 'cpython',
 'implementation_version': '3.10.8',
 'os_name': 'posix',
 'platform_machine': 'arm64',
 'platform_python_implementation': 'CPython',
 'platform_release': '21.6.0',
 'platform_system': 'Darwin',
 'platform_version': 'Darwin Kernel Version 21.6.0: Wed Aug 10 14:28:35 PDT '
                     '2022; root:xnu-8020.141.5~2/RELEASE_ARM64_T8101',
 'python_full_version': '3.10.8',
 'python_version': '3.10',
 'sys_platform': 'darwin'}

System environment variables:

  • [REDACTED]

Pipenv–specific environment variables:

  • PIPENV_VENV_IN_PROJECT: 1

Debug–specific environment variables:

  • PATH: [REDACTED]
  • SHELL: /bin/zsh
  • LANG: en_CA.UTF-8
  • PWD: [REDACTED]

natgads avatar Dec 15 '22 04:12 natgads

I'm seeing the same behavior.

RobBednark avatar Jan 23 '24 15:01 RobBednark

hi!

when the patch is also provided, and the fix is just literally 2 letter; then is there something which held this issue back for more than a year??

goyalyashpal avatar Feb 09 '24 18:02 goyalyashpal

Please open a PR -- until a PR is opened by someone, its hard to tell when a patch is provided, otherwise and the code may have gone stale from that.

matteius avatar Feb 09 '24 21:02 matteius

I’m no longer interested in offering a fix. Hopefully it’s still an easy solution for someone to take on.

natgads avatar Feb 10 '24 02:02 natgads