Request for `PIPENV_ONLY_USE_PYENV` environment variable.
See original GitHub issueIs your feature request related to a problem? Please describe.
We are using a combination of linuxbrew, pipenv and pyenv on our linux agents in our CI system. Unfortunately due to reasons, homebrew removed all installation options. This means that on Linux, all Pythons installed with brew do not have Tkinter support enabled.
It’s an issue because, depending on what version is requested by the devs, they may or may not get a working Python and since brew usually has the most up to date releases, these are often the ones requested. This could be (and probably will be) worked around with much difficulty by creating our own Python formula on our own brew tap.
Describe the solution you’d like
I would love another environment variable that would force pipenv to only use pythons provided by pyenv. This would help make our CI system far more deterministic and predictable. Basically the opposite to PIPENV_DONT_USE_PYENV
, maybe PIPENV_ONLY_USE_PYENV
.
I could also see it being beneficial to those working on an older system like CentOS 6 who might only specify python 2 in their Pipfile. Currently the behaviour would be to use the system python (which I believe is 2.6) but I think most developers who write that in their Pipfile are working around the lack of version specifiers available for the Python version and mostly just want to use one of the most recent versions of Python 2.
Describe alternatives you’ve considered
For our particular CI system, we have resorted to refusing to allow many of our Python applications to be tested on our Linux agents. As mentioned above, we are considering creating our own Python formula with tk support hard coded.
Another option could be to provide a blacklist of Python executables that will not be considered available to pipenv like PIPENV_EXCLUDE_PYTHONS=/home/linuxbrew/.linuxbrew/bin/python:/home/linuxbrew/.linuxbrew/bin/python2:/home/linuxbrew/.linuxbrew/bin/python3
.
Potentially this could also be a list of directories where any python executable found in within is removed from the list of available Python installations.
Additional context
We have everything working on our Mac agents since they have indeed hard coded tk support into the brew formula but it would still be nice to be able to say for sure that all Pythons available to pipenv in our CI system were created with pyenv.
This has been tested on both Ubuntu (18.04) and CentOS (7) but after looking at the linuxbrew python formula, it should be true of all linuxbrew installations.
$ pipenv --support
Pipenv version: '2018.11.26'
Pipenv location: '/home/linuxbrew/.linuxbrew/Cellar/pipenv/2018.11.26_2/libexec/lib/python3.7/site-packages/pipenv'
Python location: '/home/linuxbrew/.linuxbrew/Cellar/pipenv/2018.11.26_2/libexec/bin/python3.7'
Python installations found:
3.6.7
:/usr/bin/python3.6m
3.6.7
:/usr/bin/python3.6
2.7.15
:/usr/bin/python
PEP 508 Information:
{'implementation_name': 'cpython',
'implementation_version': '3.7.4',
'os_name': 'posix',
'platform_machine': 'x86_64',
'platform_python_implementation': 'CPython',
'platform_release': '4.15.0-54-generic',
'platform_system': 'Linux',
'platform_version': '#58-Ubuntu SMP Mon Jun 24 10:55:24 UTC 2019',
'python_full_version': '3.7.4',
'python_version': '3.7',
'sys_platform': 'linux'}
System environment variables:
PATH
PIPENV_VENV_IN_PROJECT
LS_COLORS
SSH_CONNECTION
LESSCLOSE
_
LANG
PYENV_ROOT
PIPENV_MAX_DEPTH
XDG_SESSION_ID
USER
PWD
HOME
SSH_CLIENT
XDG_DATA_DIRS
PIPENV_YES
PIPENV_NOSPIN
HOMEBREW_REPOSITORY
SSH_TTY
MAIL
SHELL
TERM
SHLVL
PYENV_SHELL
HOMEBREW_PREFIX
MANPATH
LOGNAME
XDG_RUNTIME_DIR
PIPENV_COLORBLIND
HOMEBREW_CELLAR
INFOPATH
LESSOPEN
PIP_DISABLE_PIP_VERSION_CHECK
PYTHONDONTWRITEBYTECODE
PIP_SHIMS_BASE_MODULE
PIP_PYTHON_PATH
PYTHONFINDER_IGNORE_UNSUPPORTED
Pipenv–specific environment variables:
PIPENV_VENV_IN_PROJECT
:1
PIPENV_MAX_DEPTH
:5
PIPENV_YES
:1
PIPENV_NOSPIN
:1
PIPENV_COLORBLIND
:1
Debug–specific environment variables:
PATH
:/home/linuxbrew/.linuxbrew/Cellar/pipenv/2018.11.26_2/libexec/tools:/home/REDACTED/.pyenv/shims:/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
SHELL
:/bin/bash
LANG
:en_US.UTF-8
PWD
: /home/REDACTED
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (2 by maintainers)
Top GitHub Comments
Hi guys, just hoping maybe you could change the label from “question” to “enhancement” so this doesn’t get lost. Once I have a little more time, I’d be happy to implement this myself and do a PR.
I’d just like to check that this is functionality that is understood and wanted by anyone other than myself.
I’d prefer if the environment variable were called
PIPENV_PYENV_ONLY
or something less verbose thanPIPENV_ONLY_USE_PYENV
. Also what if someone wants to only use asdf (I’ve never used this)? Maybe something more thoughtful to different modes for searching for Python, since there are still a number of issue reports about python finding logic floating around. Just some thoughts as I comb through the backlog again.