Hi! is there a pants command to query pants that r...
# general
p
Hi! is there a pants command to query pants that returns which python interpretor it uses?
e
It's almost certainly not a uniform answer. Try
./pants repl <some set of python targets or files or dirs>
then ask
sys.executable
.
p
arh thx
possible to do that in a similar form
./pants option blahvarianle
b
For a bit more context: what are you trying to do with the interpreter once known?
p
We have a terrible script which need to use python interpreter, I want to use the same one as pants
So it won’t blow up that bad
Yes, alternative route is get pants to execute that script
e
@plain-sundown-25537 how do you run Pants? A checked in
pants
script or the (not so) new scie-pants binary?
p
It is a random script in pants folder …
b
Ah okay, for the immediate need, another approach might be using
pants export
to create a venv with all the dependencies and an appropriate interpreter and then execute the script with that venv activated… having pants execute the script might be better if possible, though
🙏 1
p
Agree .. let me try
h
"the interpreter Pants uses" could mean two things: 1) the interpreter it uses on your code, or 2) the interpreter it uses to run itself. You shouldn't generally need to know or care about 2) unless writing plugins. So I assume you mean 1)?
👍 1
p
Yes that is (1)
h
Ah, then
pants export
will give you a venv as @broad-processor-92400 mentioned. Or you can just
pants run
the script, no?
👍 1