Hey! These docs are for version 2.0, which is no longer officially supported. Click here for the latest version, 2.7!

run

Run a pex_binary target.

To run an executable/script, simply use ./pants run on a pex_binary target, like this:

$ ./pants run project/app.py

or

$ ./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 $PATH).

πŸ“˜

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?

Run ./pants dependencies --transitive path/to/binary.py to ensure that all the files you need are showing up, including for any resources you intend to use.

Passing arguments

To pass arguments to the script/executable, use -- at the end of the command, like this:

$ ./pants run project/app.py -- --arg1 arg2 arg3

Did this page help you?