pantsbuild / pants

The Pants Build System
https://www.pantsbuild.org
Apache License 2.0
3.19k stars 613 forks source link

Refactor venv export to use explicit `PythonExecutable` lookup #21087

Closed cognifloyd closed 2 weeks ago

cognifloyd commented 2 weeks ago

Instead of relying on the implicit pex interpreter resolution--based on interpreter_constraints--this PR makes the export pre-calculate which interpreter to use.

This has the benefit of allowing pants to provide the python interpreter (eg with pyenv) if configured to do so. Without this, the exports can only use pre-installed interpreters.

To make this work, I had to prevent the injection of PexRequest.interpreter_constraints when PexRequest.python is set.

This refactor is pre-work for #20516.