I know that there are 2 different methods of proce...
# general
b
I know that there are 2 different methods of process execution in the Pants codebase called
Process
(which executes external processes) and
VenvPexProcess
(which runs inside a virtual environment + PEX). Is there a way to run a OS-level process inside the venv, but NOT using PEX?
e
That's not quite right. There is only really Process. A VenvPexProcess just ensures a venv is built from a PEX (instead of running the PEX directly), and then the Process runs inside that built venv; so Pex is not involved at that point.
Perhaps you can clarify what you're trying to do a bit.
b
Ah okay, got it. I’m trying to run
ruff
from the command line inside a venv and was trying to go through the Pants internals to see how it works; it uses
VenvPexProcess
internally and I see that there is an open issue on Github here on what seems like the same thing: https://github.com/pantsbuild/pants/issues/19270 https://github.com/pantsbuild/pants/blob/main/src/python/pants/backend/python/lint/ruff/rules.py#L72
e
Gotcha. Yeah, super strange the ruff rules got written that way!
b
I’m happy to tackle that issue as well since it is very related to what I’m trying to do - but I was trying to work out how to build the necessary venv from a lockfile (located in that same directory) and then execute a process inside that venv. But from what you described above, it seems like that’s pretty much what
VenvPexProcess
does?
e
Well you don't want to run ruff in a venv IIUC. You want to run the ruff native binary pointed at a venv. Is that right? In other words, you can install ruff on a machine and then run it against many and arbitrary venvs, correct?
b
Yup that’s right
e
@better-van-82973 the issue you point to is just a perf optimization in the end, the current ruff support should already do what you describe.
Are you encountering an error?
b
Okay, sounds good - thanks! I’ll keep playing around with it and see if I run into any issues
No errors so far! I was just playing around with it to figure out how to customize the arguments, but I found that already