jolly-midnight-72759
07/30/2021, 3:25 PM./pants repl
? Does extra_env
work everywhere or is it just a test
thing?enough-analyst-54434
07/30/2021, 3:49 PM$ BOB=jake ./pants repl src/python/pants/util
Python 3.7.11 (default, Jul 2 2021, 16:46:08)
[GCC 11.1.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> import os; os.environ["BOB"]
'jake'
>>>
And you can also permanently set these in pants.toml using [subprocess-environment] env_vars
(see: https://www.pantsbuild.org/docs/reference-subprocess-environment#section-env-vars) as well (here I use the CLI flag form instead):
$ ./pants --subprocess-environment-env-vars="BOB=jane" repl src/python/pants/util
08:47:35.78 [INFO] Starting: Resolving plugins: hdrhistogram, toolchain.pants.plugin==0.13.1
08:47:40.00 [INFO] Completed: Resolving plugins: hdrhistogram, toolchain.pants.plugin==0.13.1
08:47:42.24 [INFO] Completed: Extracting 3 requirements to build requirements.pex from lockfile.pex: ansicolors==1.1.8, packaging==20.9, typing-extensions==3.7.4.3
08:47:52.42 [INFO] Completed: Resolving 3rdparty/python/lockfiles/user_reqs.txt
Python 3.7.11 (default, Jul 2 2021, 16:46:08)
[GCC 11.1.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> import os; os.environ["BOB"]
'jane'
>>>
now exiting InteractiveConsole...
jolly-midnight-72759
07/30/2021, 3:52 PMenough-analyst-54434
07/30/2021, 3:53 PMjolly-midnight-72759
07/30/2021, 3:53 PMenough-analyst-54434
07/30/2021, 3:55 PMjolly-midnight-72759
07/30/2021, 4:10 PMhundreds-father-404
07/30/2021, 4:19 PMenough-analyst-54434
07/30/2021, 4:19 PM