Skip to main content
Version: 2.8 (deprecated)

Running Pants from sources


Running Pants from sources in its own repo

In most repos, the ./pants runner script invokes a pre-built release of Pants. However in the Pants repo itself, the ./pants runner script is different - it invokes Pants directly from the sources in that repo.

This allows you to iterate rapidly when working in the Pants repo: You can edit Rust and Python source files, and immediately run ./pants to try out your changes. The script will ensure that any Rust changes are compiled and linked, and then run Pants using your modified sources.

Running Pants from sources in other repos

Sometimes you may want to try out your Pants changes on code in some other repo. You can do so with a special ./pants_from_sources script that you copy into that repo.

This script expects to find a clone of the Pants repo, named pants, as a sibling directory of the one you're running in, and it will use the sources in that sibling to run Pants in the other repo, using that repo's config file and so on.

You can find an example of this script here. To copy it into your repo, use

curl -L -O https://raw.githubusercontent.com/pantsbuild/example-python/main/pants_from_sources &&
chmod +x pants_from_sources