Is it possible to change the path of the virtualen...
# general
Is it possible to change the path of the virtualenv generated by "pants export ::"? I'd like its path to be fully generic (i.e. not include Python version) so I can include a generic VSCode configuration in the repository, making it easier for other people to setup their environment.
not currently. the base path for the output path is determined here: it would be a relatively easy PR to make that configurable
(one line for a new option, and then consume that option at the above linked line of code)
My issue looks more related to The "not generic" part being the Pyhon version:
Copy code
$ cat .vscode/settings.json
  "python.defaultInterpreterPath": "./dist/export/python/virtualenvs/python-default/3.9.14/bin/python"
I know my request may look weird as I end up in that situation because I use resolves... But I am not sure what would be the cleanest way to handle it.
Guess the proper solution would be to write a VSCode extension to manage a Pants monorepo. For now, I'll live with that ugly snippet:
I don't see anything in the commit history to suggest why the venv is exported with the Python version.
I guess that's because a package can override the default Python version, in which case I'd expect Pants to build virtualenvs for multiple Python versions
I think it's because, generically, you can specify an interpreter constraint range in Pants. So, say you had
- aka: any of Python
. When the venv is exported, Pants needs to pick a concrete interpreter, say Python 3.7. That venv will then include the Python 3.7-appropriate deps. Like, say, maybe an extra
the other Python versions don't need or a Python 3.7 platform-specific wheel (vs one for
👆 1
Guess @happy-kitchen-89482 knows the actual reasoning behind this choice? 🙂
Yep, it was deliberate, so you know which specific interpreter was selected, and can distinguish them if a different one is selected later
👍 1