ripe-gigabyte-88964
04/27/2023, 6:27 PMVIRTUAL_ENV
environment variable is set and also that the PATH
is inheriting from my terminal. Is there a way I can easily include the VIRTUAL_ENV
path in my PATH
variable or do I need to manually export the venv first?enough-analyst-54434
04/27/2023, 6:36 PM--venv append|prepend
when building it.enough-analyst-54434
04/27/2023, 6:38 PM$ pex cowsay --venv prepend -o cowsay.pex
$ ./cowsay.pex -c 'import subprocess, sys; subprocess.check_call(["cowsay", *sys.argv[1:]])' 'Moo!'
____
| Moo! |
====
\
\
^__^
(oo)\_______
(__)\ )\/\
||----w |
|| ||
ripe-gigabyte-88964
04/27/2023, 6:39 PMdagster_pex_request = await Get(
VenvPexRequest,
PexRequest(
output_filename="dagster.pex",
internal_only=True,
requirements=pex_requirements,
inject_env={"DAGSTER_ENVIRONMENT": "LOCAL_DEV"},
interpreter_constraints=InterpreterConstraints(
python_setup.resolves_to_interpreter_constraints[dagster_subsystem.resolve]
),
main=EntryPoint("dagster"),
),
)
dagster_pex = await Get(VenvPex, VenvPexRequest, dagster_pex_request)
Building it as part of a pluginenough-analyst-54434
04/27/2023, 6:40 PMenough-analyst-54434
04/27/2023, 6:41 PM$ git grep -C10 '"\--venv"' src/python/pants/backend/python/util_rules/pex.py
src/python/pants/backend/python/util_rules/pex.py- # named caches store might be pruned at any time. To guard against that case we introduce a shim
src/python/pants/backend/python/util_rules/pex.py- # bash script that checks to see if the `pex` venv script exists in the PEX_ROOT and re-creates
src/python/pants/backend/python/util_rules/pex.py- # the PEX_ROOT venv if not. Using the shim script to run Python tools gets us down to the ~1ms
src/python/pants/backend/python/util_rules/pex.py- # of overhead we currently enjoy.
src/python/pants/backend/python/util_rules/pex.py-
src/python/pants/backend/python/util_rules/pex.py- pex_request = request.pex_request
src/python/pants/backend/python/util_rules/pex.py- seeded_venv_request = dataclasses.replace(
src/python/pants/backend/python/util_rules/pex.py- pex_request,
src/python/pants/backend/python/util_rules/pex.py- additional_args=pex_request.additional_args
src/python/pants/backend/python/util_rules/pex.py- + (
src/python/pants/backend/python/util_rules/pex.py: "--venv",
src/python/pants/backend/python/util_rules/pex.py- "--seed",
src/python/pants/backend/python/util_rules/pex.py- "verbose",
src/python/pants/backend/python/util_rules/pex.py- pex_environment.venv_site_packages_copies_option(
src/python/pants/backend/python/util_rules/pex.py- use_copies=request.site_packages_copies
src/python/pants/backend/python/util_rules/pex.py- ),
src/python/pants/backend/python/util_rules/pex.py- ),
src/python/pants/backend/python/util_rules/pex.py- )
src/python/pants/backend/python/util_rules/pex.py- venv_pex_result = await Get(BuildPexResult, PexRequest, seeded_venv_request)
src/python/pants/backend/python/util_rules/pex.py- # Pex verbose --seed mode outputs the absolute path of the PEX executable as well as the
src/python/pants/backend/python/util_rules/pex.py- # absolute path of the PEX_ROOT. In the --venv case this is the `pex` script in the venv root
enough-analyst-54434
04/27/2023, 6:42 PM--venv
but not --venv prepend
or --venv append
.enough-analyst-54434
04/27/2023, 6:42 PMripe-gigabyte-88964
04/27/2023, 7:16 PMripe-gigabyte-88964
04/27/2023, 7:39 PM"PEX_VENV_BIN_PATH": "prepend"
as an env var to my process worked!enough-analyst-54434
04/27/2023, 8:14 PM