pipenv icon indicating copy to clipboard operation
pipenv copied to clipboard

Feature request: `--config-settings` options with `pipenv install`

Open duckki opened this issue 1 year ago • 7 comments

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

pip install accepts --config-settings X=Y options, but it seems not possible to pass it using pipenv install.

Describe the solution you'd like

I would like to be able to run pipenv install as following:

$ pipenv install --editable . --config-settings X=Y

The --config-settings should be reflected in the Pipfile. So, pipenv install can reproduce it elsewhere.

Describe alternatives you've considered

I uninstall the package and reinstall it with pip within the pipenv shell.

$ pip3 uninstall X
$ pip3 install --editable . --config-settings X=Y

Additional context

The motivation was to use pip3 install --editable . --config-settings editable_mode=strict to control setuptools. (See https://setuptools.pypa.io/en/latest/userguide/development_mode.html)


$ pipenv --support

Pipenv version: '2022.4.8'

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

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

Python installations found:

  • 3.10.9: /opt/homebrew/bin/python3
  • 3.9.16: /Users/duckki/.virtualenvs/slither-task-6QVhErCU/bin/python3
  • 3.9.16: /Users/duckki/.virtualenvs/slither-task-6QVhErCU/bin/python
  • 3.9.16: /Users/duckki/.virtualenvs/slither-task-6QVhErCU/bin/python3.9
  • 3.9.16: /Users/duckki/.virtualenvs/slither-task-6QVhErCU/bin/python3
  • 3.9.16: /Users/duckki/.virtualenvs/slither-task-6QVhErCU/bin/python
  • 3.9.16: /Users/duckki/.virtualenvs/slither-task-6QVhErCU/bin/python3.9
  • 3.9.16: /opt/homebrew/opt/[email protected]/libexec/bin/python3
  • 3.9.16: /opt/homebrew/opt/[email protected]/libexec/bin/python
  • 3.9.16: /opt/homebrew/bin/python3.9
  • 3.9.6: /usr/bin/python3

PEP 508 Information:

{'implementation_name': 'cpython',
 'implementation_version': '3.9.16',
 '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: Thu Mar  9 20:12:21 PST '
                     '2023; root:xnu-8020.240.18.700.8~1/RELEASE_ARM64_T6000',
 'python_full_version': '3.9.16',
 'python_version': '3.9',
 'sys_platform': 'darwin'}

System environment variables:

  • TERM_SESSION_ID
  • SSH_AUTH_SOCK
  • LC_TERMINAL_VERSION
  • COLORFGBG
  • ITERM_PROFILE
  • XPC_FLAGS
  • LANG
  • PWD
  • SHELL
  • __CFBundleIdentifier
  • SECURITYSESSIONID
  • TERM_PROGRAM_VERSION
  • TERM_PROGRAM
  • PATH
  • DISPLAY
  • LC_TERMINAL
  • COLORTERM
  • COMMAND_MODE
  • TERM
  • HOME
  • TMPDIR
  • USER
  • XPC_SERVICE_NAME
  • LOGNAME
  • LaunchInstanceID
  • __CF_USER_TEXT_ENCODING
  • ITERM_SESSION_ID
  • SHLVL
  • OLDPWD
  • HOMEBREW_PREFIX
  • HOMEBREW_CELLAR
  • HOMEBREW_REPOSITORY
  • MANPATH
  • INFOPATH
  • RIPGREP_CONFIG_PATH
  • ZSH
  • PAGER
  • LESS
  • LSCOLORS
  • VIRTUALENVWRAPPER_PROJECT_FILENAME
  • VIRTUALENVWRAPPER_WORKON_CD
  • VIRTUALENVWRAPPER_SCRIPT
  • WORKON_HOME
  • VIRTUALENVWRAPPER_HOOK_DIR
  • OPAM_SWITCH_PREFIX
  • CAML_LD_LIBRARY_PATH
  • OCAML_TOPLEVEL_PATH
  • PIP_DISABLE_PIP_VERSION_CHECK
  • PIP_PYTHON_PATH
  • PYTHONDONTWRITEBYTECODE
  • PIPENV_ACTIVE
  • VIRTUAL_ENV
  • PS1
  • _
  • PIP_SHIMS_BASE_MODULE
  • PYTHONFINDER_IGNORE_UNSUPPORTED

Pipenv–specific environment variables:

  • PIPENV_ACTIVE: 1

Debug–specific environment variables:

  • PATH: /Users/duckki/.virtualenvs/slither-task-6QVhErCU/bin:/Users/duckki/.opam/default/bin:/Users/duckki/.poetry/bin:/Users/duckki/.poetry/bin:/Users/duckki/local/bin:/opt/homebrew/opt/coreutils/libexec/gnubin:/opt/homebrew/opt/[email protected]/libexec/bin:/Users/duckki/.opam/default/bin:/Users/duckki/.poetry/bin:/Users/duckki/.poetry/bin:/Users/duckki/local/bin:/opt/homebrew/opt/coreutils/libexec/gnubin:/opt/homebrew/opt/[email protected]/libexec/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Users/duckki/.foundry/bin:/Users/duckki/.foundry/bin
  • SHELL: /bin/zsh
  • LANG: en_US.UTF-8
  • PWD: /Users/duckki/work/slither-task
  • VIRTUAL_ENV: /Users/duckki/.virtualenvs/slither-task-6QVhErCU

Contents of Pipfile ('/Users/duckki/work/slither-task/Pipfile'):

[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"

[packages]
toml = "*"
semver = "*"
solc-select = "*"
urllib3 = "*"
antlr4-python3-runtime = "==4.9"
slither-analyzer = {editable = true, path = "./utilities/slither"}
certik-slither-plugin = {editable = true, path = "./slither-plugin"}

[dev-packages]

[requires]
python_version = "3.9"

duckki avatar Jun 17 '23 19:06 duckki

Is this different from what you can do with `` --extra-pip-args=""`?

matteius avatar Jun 18 '23 00:06 matteius

Thanks for suggestion. I didn't know --extra-pip-args.

I updated pipenv to version 2023.6.12 and ran pipenv install --editable . --extra-pip-args="--config-settings editable_mode=strict"

It finished without an error. However, the "editable_mode=strict" was not effective. The result was the same as installing without the --config-settings option. Also, the Pipfile didn't change, either.

duckki avatar Jun 18 '23 01:06 duckki

I think this has to do with parsing of extra-pip-args if I'm remembering correctly. While spaces can be used in Python between an optional command-line argument and its value, in order to properly parse multiple extra-pip-args, you need to make sure there's an equal sign between the argument and its value, e.g. --extra-pip-args="--pip-arg=value". In your case, you may need to add an extra set of escaped quotation marks to ensure the argument is parsed properly. Let me know if this works for you, and I'll re-familiarize myself with this part of the codebase.

kalebmckale avatar Aug 16 '23 02:08 kalebmckale

I tried: pipenv install --editable <path> --extra-pip-args="--config-settings=editable_mode=strict" It finished to completion. But, editable_mode=strict wasn't effective. Also, the Pipfile didn't change, either.

duckki avatar Aug 17 '23 19:08 duckki

Because of the complicated syntax, this may be something that has to be updated via environment variable instead. @matteius any ideas?

kalebmckale avatar Aug 19 '23 15:08 kalebmckale

It needs to be supported at the Pipfile as a new dictionary key for specifying additional pip install args -- it will get complicated determining if the install arg needs to be done in its own install phase or if it can be provided at the per requirement level in the existing install phases.

matteius avatar Aug 22 '23 01:08 matteius

FYI, installing a python package using --config-settings editable_mode=compat or --config-settings editable_mode=strict is a workaround for fixing unresolved reference issues for editable packages when using Pycharm. See this comment on PY-976 for more information.

salimhamed avatar Oct 26 '23 03:10 salimhamed