Pants v2: Fast, consistent builds for Python and more

Welcome to the Pants v2 documentation hub!

Pants v2 is a fast, scalable build system for growing codebases. It's currently focused on Python, with support for other languages coming soon.

Here you'll find guides to help you get started with Pants v2, comprehensive documentation on how to configure, run and customize Pants v2, and information on how to get help from the Pants community.

Get Started

Configuration for roots of source trees.

Config section: [source]

Basic options

None

Advanced options

--source-unmatched=<str>
PANTS_SOURCE_UNMATCHED
unmatched
one of: create, fail
default: create
Configures the behavior when sources are defined outside of any configured source root. `create` will cause a source root to be implicitly created at the definition location of the sources; `fail` will trigger an error.

--source-root-patterns="[["pattern1", "pattern2", ...], ["pattern1", "pattern2", ...], ...]"
PANTS_SOURCE_ROOT_PATTERNS
root_patterns
default:
[
  "/",
  "src",
  "src/python",
  "src/py"
]

A list of source root suffixes. A directory with this suffix will be considered a potential source root. E.g., `src/python` will match `<buildroot>/src/python`, `<buildroot>/project1/src/python` etc. Prepend a `/` to anchor the match at the buildroot. E.g., `/src/python` will match `<buildroot>/src/python` but not `<buildroot>/project1/src/python`. A `*` wildcard will match a single path segment, e.g., `src/*` will match `<buildroot>/src/python` and `<buildroot>/src/rust`. Use `/` to signify that the buildroot itself is a source root. See https://www.pantsbuild.org/docs/source-roots.

--source-marker-filenames="[filename, filename, ...]"
PANTS_SOURCE_MARKER_FILENAMES
marker_filenames
default: []
The presence of a file of this name in a directory indicates that the directory is a source root. The content of the file doesn't matter, and may be empty. Useful when you can't or don't wish to centrally enumerate source roots via --root-patterns.

Deprecated options

None

Updated about a month ago


source


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.