From d074ffab7fb7dbc30c631ec6376e8e376887ddc8 Mon Sep 17 00:00:00 2001 From: Fridolin Pokorny Date: Mon, 3 Sep 2018 20:00:05 +0200 Subject: [PATCH] PEEP-002: Specify options via environment variables --- peeps/PEEP-002.md | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 peeps/PEEP-002.md diff --git a/peeps/PEEP-002.md b/peeps/PEEP-002.md new file mode 100644 index 00000000..1ee289b3 --- /dev/null +++ b/peeps/PEEP-002.md @@ -0,0 +1,32 @@ +# PEEP-002: Specify options via environment variables + +This PEEP describes an addition that would allow configuring pipenv options via environment variables suitable especially for automated systems or CI/CD systems. + +☤ + +Systems running not only on containerized solutions (like Kubernetes or OpenShift) are often parametrized via environment variables. The aim of this PEEP is to provide an extension to the current pipenv implementation that would simplify parametrizing options passed via environment variables. + +The current implementation requires most of the options to be passed via command line. It is possible to adjust some of the command line options via pre-defined names of environment variables (such as ``PIPENV_PYTHON``) but this approach does not allow to define environment variables for all of the options that can be possibly passed to pipenv. + +The proposed approach is to re-use existing options passing via environment variables avaliable in [click](http://click.pocoo.org/5/options/#values-from-environment-variables>) (bundled with pipenv). All of the options for available pipenv's sub-commands can directly pick options passed via environment variables: + +```console +$ export PIPENV_INSTALL_DEPLOY=1 +$ export PIPENV_INSTALL_VERBOSE=1 +$ pipenv install +``` + +The naming schema for environment variables configuring options is following: + +``` +PIPENV__ +``` + +where sub-command is an uppercase name of pipenv's sub-command (such as `install`, `run` or others) and option name is the name of pipenv's sub-command option all in uppercase. Any dashes are translated to underscores; flags accept `1` signalizing the flag to be present. + +The naming schema guarantees no clashes for the already existing pipenv configuration using environment variables. + +The proposed configuration via environment variables is available for pipenv sub-commands. Options supplied via command line have higher priority than the ones supplied via environment variables. + +Author: Fridolín Pokorný +