Get Pipenv
- get_pipenv
Functions to help install pipenv with only python installed and no elevated privileges, no pip
or sudo
required
- install_pipenv
Install pipenv into a virtualenv. Does not need to have pip already installed and does not use privileged permissions. Makes use of the virtualenv zipapp, as per https://virtualenv.pypa.io/en/latest/installation.html#via-zipapp
While virtualenv documentation recommends download of the virtualenv zipapp file from https://bootstrap.pypa.io/virtualenv, this script instead downloads from https://github.com/pypa/get-virtualenv/ which offered versioned zipapp files. This avoids possible breaking changes introduced at the pypa bootstrap site.
Prefer use of RECIPE_*
environment variables (e.g., prefer RECIPE_PIPENV_VERSION
over PIPENV_VERSION
). Pipenv uses PIPENV_{FLAG_NAME}
to control command line execution via environment variables, as per https://github.com/pypa/pipenv/blob/master/CHANGELOG.rst#features–improvements-4. Use of PIPENV_VERSION
to control the installed pipenv version may cause subsequent calls to pipenv to fail with the error Error: Invalid value for '--version': 2020.11.15 is not a valid boolean
.
Environment variables not starting with RECIPE_*
may be deprecated in the future.
- Arguments:
[
$1
] - The location of the virtualenv, defaults to${RECIPE_PIPENV_VIRTUALENV-${PIPENV_VIRTUALENV-${HOME}/pipenv}}
- Parameters:
RECIPE_PIPENV_PYTHON
orPIPENV_PYTHON
- Optionally specify which python you want to use. Default is to favor python3, tryingpython3
,python
, then finally falling back topython2
.RECIPE_PIPENV_VERSION
orPIPENV_VERSION
- The version of pipenv to install, defaults -2022.1.8
RECIPE_VIRTUALENV_PYZ
orVIRTUALENV_PYZ
- Name of downloadedvirtualenv.pyz
, else it will attempt to download it itself.RECIPE_VIRTUALENV_VERSION
orVIRTUALENV_VERSION
- The version of virtualenv to use, affecting both the virtualenv zipapp version and the virtualenv version used by pipenv environment. defaults to20.13.3
- setup_container_pipenv
Sets up some additional behavior, useful in a container. Creates a symlink in the path to pipenv
and adds a fake_package
script to the bin directory for faking out local packages in pipenv during container build stages.
- Arguments:
[
$1
] - The location of the virtualenv, defaults to${HOME}/pipenv
[
$2
] - The location of the symlink for pipenv, defaults to/usr/local/bin/pipenv