<#22117 Pants with python provider backend still u...
# github-notifications
c
#22117 Pants with python provider backend still uses PATH in pex calls Issue created by KristianTashkov Describe the bug Many pex building calls still propagate your PATH variable even when using a python provider backend like "pants.backend.python.providers.experimental.python_build_standalone". This means that even with a hermetic python calling pants from a different context (different PATH contents) means it doesn't share it's cache between those runs. Pants version 2.25.0 OS MacOS Additional info Original slack conversation about this with @huonw : here I've gotten it to work by adding the following to `pants.toml`:
Copy code
[pex]
executable_search_paths = [
  "<PYENV>",
]

# <https://www.pantsbuild.org/stable/reference/subsystems/python-bootstrap#search_path>
[python-bootstrap]
search_path = [
  "<PYENV>",
]

# <https://www.pantsbuild.org/stable/reference/subsystems/subprocess-environment#env_vars>
[subprocess-environment]
env_vars.remove = [
  "LANG",
  "LC_CTYPE",
  "LC_ALL",
]
The first two options above work with empty arrays as well for normal
lint
check
etc. commands, but
pants package
on a
pex_binary
target fails to resolve a python (#21048) so using fixed list instead to circumvent that. The
locale
ENV variables turned out to be another problem that depending on the locale ENVs set in your terminal, you can still miss reusing cache since those are propagated automatically. pantsbuild/pants