Hello, just a quick question this time. I'm using ...
# general
f
Hello, just a quick question this time. I'm using
pants export
to get a local virtualenv, and it's being created in a directory with the current Python version number,
dist/export/python/virtualenvs/python-default/3.9.21/
. I want to have some automation that uses this env, so is there a way I can get the export directory path in a programatic way? Or can I customize it so the output dir won't rely on whatever the current Py version is?
e
I've set up scripts just using a path as
Copy code
dist/export/python/virtualenvs/python-default/*/bin/python
which works if you go through anything that will perform shell expansion.
Another alternative is to just use
pants run
to run anything from the resolve, rather than exporting the venv at all.
(I know that doesn't work for all automations... sometimes you just need the path)
f
Is it guaranteed there'll only be one version at a time then?
tbh I might just add a setup line like
mv dist/export/python/virtualenvs/python-default/* mdist/export/python/virtualenvs/python-default/specific-dir
Would make life easier I think 🙂
e
True! or a symlink could work too
f
Symlinks can't contain
*
though (I think?)
e
no, you'd have to have updating the symlink be part of your export process
I think it is not guaranteed there will only be one version (you could always upgrade versions and export again and the old one would still be there)
but I think that's more a cleanup problem and in most cases (eg. CI runner or similar) you would only have one version (unless you are explicitly doing multi-version things)
f
I can probably add a pre-emptive
rm -rf
as part of the export script I'm building, we shouldn't ever need more than one at a time
e
that ought to work