To run an executable/script, simply use
./pants run on a
pex_binary target, like this:
$ ./pants run project/app.py
$ ./pants run project:app
You may only run one target at a time.
The program will have access to the same environment used by the parent
./pants process, so you can set environment variables in the external environment, e.g.
FOO=bar ./pants run project/app.py. (Pants will auto-set some values like
Tip: check the return code
Pants will propagate the return code from the underlying executable. Run
echo $?after the Pants run to see the return code.
Issues finding files?
./pants dependencies --transitive path/to/binary.pyto ensure that all the files you need are showing up, including for any resources you intend to use.
To pass arguments to the script/executable, use
-- at the end of the command, like this:
$ ./pants run project/app.py -- --arg1 arg2 arg3
Updated about a month ago